Updated site factory to use new factory interface
authorThierry Florac <thierry.florac@onf.fr>
Thu, 22 Mar 2018 14:43:34 +0100
changeset 156 3ac4eb0a2b89
parent 155 d90f8f91f851
child 157 aedd98145b97
Updated site factory to use new factory interface
src/pyams_utils/site.py
--- a/src/pyams_utils/site.py	Thu Mar 22 14:42:18 2018 +0100
+++ b/src/pyams_utils/site.py	Thu Mar 22 14:43:34 2018 +0100
@@ -18,8 +18,8 @@
 # import interfaces
 from pyams_utils.interfaces import PYAMS_APPLICATION_SETTINGS_KEY, PYAMS_APPLICATION_DEFAULT_NAME, \
     PYAMS_APPLICATION_FACTORY_KEY
-from pyams_utils.interfaces.site import ISiteRoot, INewLocalSiteCreatedEvent, ISiteUpgradeEvent, ISiteGenerations, \
-    SITE_GENERATIONS_KEY, IConfigurationManager
+from pyams_utils.interfaces.site import ISiteRoot, ISiteRootFactory, INewLocalSiteCreatedEvent, ISiteUpgradeEvent, \
+    ISiteGenerations, SITE_GENERATIONS_KEY, IConfigurationManager
 from zope.annotation.interfaces import IAnnotations
 from zope.component.interfaces import IPossibleSite, ObjectEvent
 from zope.traversing.interfaces import ITraversable
@@ -91,7 +91,7 @@
             resolver = DottedNameResolver()
             factory = resolver.maybe_resolve(factory)
         else:
-            factory = BaseSiteRoot
+            factory = request.registry.queryUtility(ISiteRootFactory, default=BaseSiteRoot)
         application = root[application_key] = factory()
         if IPossibleSite.providedBy(application):
             sm = LocalSiteManager(application, default_folder=False)