add consistencies's storage
This commit is contained in:
parent
66c82ee582
commit
a1753afb8c
2 changed files with 8 additions and 5 deletions
|
@ -56,8 +56,8 @@ class Base(object):
|
|||
except AttributeError:
|
||||
self._validator_params = None
|
||||
|
||||
def _add_consistency(self, func, all_cons_opts):
|
||||
self._consistencies.append((func, all_cons_opts))
|
||||
def _add_consistency(self, func, all_cons_opts, params):
|
||||
self._consistencies.append((func, all_cons_opts, params))
|
||||
|
||||
def _get_consistencies(self):
|
||||
return self._consistencies
|
||||
|
|
|
@ -213,11 +213,13 @@ class _Consistency(SqlAlchemyBase):
|
|||
__tablename__ = 'consistency'
|
||||
id = Column(Integer, primary_key=True)
|
||||
func = Column(PickleType)
|
||||
params = Column(PickleType)
|
||||
|
||||
def __init__(self, func, all_cons_opts):
|
||||
self.func = func
|
||||
for option in all_cons_opts:
|
||||
option._consistencies.append(self)
|
||||
self.params = params
|
||||
|
||||
|
||||
class _Parent(SqlAlchemyBase):
|
||||
|
@ -294,11 +296,12 @@ class _Base(SqlAlchemyBase):
|
|||
session.add(self)
|
||||
session.commit()
|
||||
|
||||
def _add_consistency(self, func, all_cons_opts):
|
||||
_Consistency(func, all_cons_opts)
|
||||
def _add_consistency(self, func, all_cons_opts, params):
|
||||
_Consistency(func, all_cons_opts, params)
|
||||
|
||||
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):
|
||||
return self.id
|
||||
|
|
Loading…
Reference in a new issue