Use object factory in annotations adapters
authorThierry Florac <thierry.florac@onf.fr>
Thu, 17 Jan 2019 10:03:22 +0100
changeset 87 ff5591442ac3
parent 86 767542a815b1
child 88 9c464b9a33c7
Use object factory in annotations adapters
src/pyams_sequence/sequence.py
--- a/src/pyams_sequence/sequence.py	Fri Jan 11 13:53:05 2019 +0100
+++ b/src/pyams_sequence/sequence.py	Thu Jan 17 10:03:22 2019 +0100
@@ -13,16 +13,17 @@
 __docformat__ = 'restructuredtext'
 
 from persistent import Persistent
-from zope.interface import Interface, implementer
+from zope.interface import Interface
 from zope.schema.fieldproperty import FieldProperty
 
 from pyams_sequence.interfaces import ISequentialIdInfo, ISequentialIdTarget, ISequentialIntIds
 from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config, get_annotation_adapter
+from pyams_utils.factory import factory_config
 from pyams_utils.interfaces.tales import ITALESExtension
 from pyams_utils.registry import get_utility
 
 
-@implementer(ISequentialIdInfo)
+@factory_config(ISequentialIdInfo)
 class SequentialIdInfo(Persistent):
     """Sequential ID info"""
 
@@ -52,7 +53,7 @@
 @adapter_config(context=ISequentialIdTarget, provides=ISequentialIdInfo)
 def sequential_id_info_factory(context):
     """Sequential ID info factory"""
-    return get_annotation_adapter(context, SEQUENCE_INFO_KEY, SequentialIdInfo,
+    return get_annotation_adapter(context, SEQUENCE_INFO_KEY, ISequentialIdInfo,
                                   notify=False, locate=False)