--- a/src/pyams_zmi/configuration.py Wed May 23 15:25:13 2018 +0200
+++ b/src/pyams_zmi/configuration.py Mon May 28 14:07:46 2018 +0200
@@ -20,16 +20,13 @@
from pyams_utils.interfaces.site import ISiteRoot
from pyams_utils.interfaces.tales import ITALESExtension
from pyams_zmi.interfaces import IZMIConfiguration
-from pyams_zmi.layer import IAdminLayer
-from zope.annotation.interfaces import IAnnotations
# import packages
from persistent import Persistent
-from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter
+from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter, get_annotation_adapter
from pyams_utils.traversing import get_parent
from zope.container.contained import Contained
from zope.interface import implementer, Interface
-from zope.location import locate
from zope.schema.fieldproperty import FieldProperty
@@ -93,12 +90,8 @@
@adapter_config(context=ISiteRoot, provides=IZMIConfiguration)
def zmi_configuration_factory(context):
"""ZMI configuration factory"""
- annotations = IAnnotations(context)
- configuration = annotations.get(ZMI_CONFIGURATION_KEY)
- if configuration is None:
- configuration = annotations[ZMI_CONFIGURATION_KEY] = ZMIConfiguration()
- locate(configuration, context)
- return configuration
+ return get_annotation_adapter(context, ZMI_CONFIGURATION_KEY, ZMIConfiguration,
+ notify=False)
@adapter_config(name='zmi_configuration', context=(Interface, Interface, Interface), provides=ITALESExtension)