add consistencies's storage
authorEmmanuel Garette <egarette@cadoles.com>
Sun, 13 Apr 2014 08:35:43 +0000 (10:35 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Sun, 13 Apr 2014 08:35:43 +0000 (10:35 +0200)
tiramisu/storage/dictionary/option.py
tiramisu/storage/sqlalchemy/option.py

index cdddce6..0634e5e 100644 (file)
@@ -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
index fd12899..96673ad 100644 (file)
@@ -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