Added check of registry settings in dynamic schema mixin class
authorThierry Florac <thierry.florac@onf.fr>
Thu, 22 Mar 2018 14:53:53 +0100
changeset 43 450c0327037e
parent 42 de21f1dcf22a
child 44 65e7ee10fc20
Added check of registry settings in dynamic schema mixin class
src/pyams_alchemy/mixin.py
--- a/src/pyams_alchemy/mixin.py	Tue Mar 20 17:40:45 2018 +0100
+++ b/src/pyams_alchemy/mixin.py	Thu Mar 22 14:53:53 2018 +0100
@@ -39,9 +39,9 @@
         settings_name = cls.get_schema_settings_name()
         if settings_name:
             registry = get_global_registry()
-            return {'schema': registry.settings.get(settings_name, cls.__schema__)}
-        else:
-            return {'schema': cls.__schema__}
+            if hasattr(registry, 'settings'):
+                return {'schema': registry.settings.get(settings_name, cls.__schema__)}
+        return {'schema': cls.__schema__}
 
     @declared_attr
     def __table_args__(cls):