From d545c6883c9c0684d2838a1a074e6f8b7a21b052 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Fri, 30 Sep 2016 23:07:46 +0200 Subject: [PATCH] properties in option must not be sqlalchemy object --- tiramisu/storage/sqlalchemy/option.py | 5 +++-- tiramisu/storage/sqlalchemy/setting.py | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tiramisu/storage/sqlalchemy/option.py b/tiramisu/storage/sqlalchemy/option.py index 3945109..e03a934 100644 --- a/tiramisu/storage/sqlalchemy/option.py +++ b/tiramisu/storage/sqlalchemy/option.py @@ -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): diff --git a/tiramisu/storage/sqlalchemy/setting.py b/tiramisu/storage/sqlalchemy/setting.py index 260ce68..eb84be9 100644 --- a/tiramisu/storage/sqlalchemy/setting.py +++ b/tiramisu/storage/sqlalchemy/setting.py @@ -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