properties in option must not be sqlalchemy object
authorEmmanuel Garette <egarette@cadoles.com>
Fri, 30 Sep 2016 21:07:46 +0000 (23:07 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Fri, 30 Sep 2016 21:07:46 +0000 (23:07 +0200)
tiramisu/storage/sqlalchemy/option.py
tiramisu/storage/sqlalchemy/setting.py

index 3945109..e03a934 100644 (file)
@@ -489,12 +489,13 @@ class _Base(SqlAlchemyBase):
 
     def impl_getproperties(self):
         session = self.getsession()
-        return session.query(_PropertyOption).filter_by(option=self.id).all()
+        for prop in session.query(_PropertyOption).filter_by(option=self.id).all():
+            yield prop.name
 
     def _set_master_slaves(self, option):
         session = self.getsession()
         opt = session.query(_Base).filter_by(id=self.id).first()
-        opt._master_slaves = option.id
+        opt._master_slaves = option._p_.id
         self.commit(session)
 
     def _get_master_slave(self):
index 260ce68..eb84be9 100644 (file)
@@ -83,7 +83,10 @@ class Settings(Cache, SqlAlchemyBase):
         del(session)
 
     def getproperties(self, path, default_properties):
-        return self._properties.get(path, set(default_properties))
+        ret = self._properties.get(path)
+        if ret is None:
+            return set(default_properties)
+        return ret
 
     def hasproperties(self, path):
         return path in self._properties