src/pyams_utils/site.py
changeset 156 3ac4eb0a2b89
parent 148 da830ed827eb
child 168 819db271bc1f
equal deleted inserted replaced
155:d90f8f91f851 156:3ac4eb0a2b89
    16 # import standard library
    16 # import standard library
    17 
    17 
    18 # import interfaces
    18 # import interfaces
    19 from pyams_utils.interfaces import PYAMS_APPLICATION_SETTINGS_KEY, PYAMS_APPLICATION_DEFAULT_NAME, \
    19 from pyams_utils.interfaces import PYAMS_APPLICATION_SETTINGS_KEY, PYAMS_APPLICATION_DEFAULT_NAME, \
    20     PYAMS_APPLICATION_FACTORY_KEY
    20     PYAMS_APPLICATION_FACTORY_KEY
    21 from pyams_utils.interfaces.site import ISiteRoot, INewLocalSiteCreatedEvent, ISiteUpgradeEvent, ISiteGenerations, \
    21 from pyams_utils.interfaces.site import ISiteRoot, ISiteRootFactory, INewLocalSiteCreatedEvent, ISiteUpgradeEvent, \
    22     SITE_GENERATIONS_KEY, IConfigurationManager
    22     ISiteGenerations, SITE_GENERATIONS_KEY, IConfigurationManager
    23 from zope.annotation.interfaces import IAnnotations
    23 from zope.annotation.interfaces import IAnnotations
    24 from zope.component.interfaces import IPossibleSite, ObjectEvent
    24 from zope.component.interfaces import IPossibleSite, ObjectEvent
    25 from zope.traversing.interfaces import ITraversable
    25 from zope.traversing.interfaces import ITraversable
    26 
    26 
    27 # import packages
    27 # import packages
    89         factory = request.registry.settings.get(PYAMS_APPLICATION_FACTORY_KEY)
    89         factory = request.registry.settings.get(PYAMS_APPLICATION_FACTORY_KEY)
    90         if factory:
    90         if factory:
    91             resolver = DottedNameResolver()
    91             resolver = DottedNameResolver()
    92             factory = resolver.maybe_resolve(factory)
    92             factory = resolver.maybe_resolve(factory)
    93         else:
    93         else:
    94             factory = BaseSiteRoot
    94             factory = request.registry.queryUtility(ISiteRootFactory, default=BaseSiteRoot)
    95         application = root[application_key] = factory()
    95         application = root[application_key] = factory()
    96         if IPossibleSite.providedBy(application):
    96         if IPossibleSite.providedBy(application):
    97             sm = LocalSiteManager(application, default_folder=False)
    97             sm = LocalSiteManager(application, default_folder=False)
    98             application.setSiteManager(sm)
    98             application.setSiteManager(sm)
    99         try:
    99         try: