add consistencies's storage
This commit is contained in:
parent
66c82ee582
commit
a1753afb8c
|
@ -56,8 +56,8 @@ class Base(object):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
self._validator_params = None
|
self._validator_params = None
|
||||||
|
|
||||||
def _add_consistency(self, func, all_cons_opts):
|
def _add_consistency(self, func, all_cons_opts, params):
|
||||||
self._consistencies.append((func, all_cons_opts))
|
self._consistencies.append((func, all_cons_opts, params))
|
||||||
|
|
||||||
def _get_consistencies(self):
|
def _get_consistencies(self):
|
||||||
return self._consistencies
|
return self._consistencies
|
||||||
|
|
|
@ -213,11 +213,13 @@ class _Consistency(SqlAlchemyBase):
|
||||||
__tablename__ = 'consistency'
|
__tablename__ = 'consistency'
|
||||||
id = Column(Integer, primary_key=True)
|
id = Column(Integer, primary_key=True)
|
||||||
func = Column(PickleType)
|
func = Column(PickleType)
|
||||||
|
params = Column(PickleType)
|
||||||
|
|
||||||
def __init__(self, func, all_cons_opts):
|
def __init__(self, func, all_cons_opts):
|
||||||
self.func = func
|
self.func = func
|
||||||
for option in all_cons_opts:
|
for option in all_cons_opts:
|
||||||
option._consistencies.append(self)
|
option._consistencies.append(self)
|
||||||
|
self.params = params
|
||||||
|
|
||||||
|
|
||||||
class _Parent(SqlAlchemyBase):
|
class _Parent(SqlAlchemyBase):
|
||||||
|
@ -294,11 +296,12 @@ class _Base(SqlAlchemyBase):
|
||||||
session.add(self)
|
session.add(self)
|
||||||
session.commit()
|
session.commit()
|
||||||
|
|
||||||
def _add_consistency(self, func, all_cons_opts):
|
def _add_consistency(self, func, all_cons_opts, params):
|
||||||
_Consistency(func, all_cons_opts)
|
_Consistency(func, all_cons_opts, params)
|
||||||
|
|
||||||
def _get_consistencies(self):
|
def _get_consistencies(self):
|
||||||
return [(consistency.func, consistency.options) for consistency in self._consistencies]
|
return [(consistency.func, consistency.options, consistency.params)
|
||||||
|
for consistency in self._consistencies]
|
||||||
|
|
||||||
def _get_id(self):
|
def _get_id(self):
|
||||||
return self.id
|
return self.id
|
||||||
|
|
Loading…
Reference in New Issue