src/pyams_content/shared/view/theme.py
changeset 1240 921ff38f1aae
parent 1217 ac40004d7c73
child 1389 1485db1e2b5e
--- a/src/pyams_content/shared/view/theme.py	Wed Jan 16 19:10:46 2019 +0100
+++ b/src/pyams_content/shared/view/theme.py	Thu Jan 17 12:17:24 2019 +0100
@@ -16,7 +16,6 @@
 from hypatia.query import Any
 from persistent import Persistent
 from zope.container.contained import Contained
-from zope.interface import implementer
 from zope.intid.interfaces import IIntIds
 from zope.schema.fieldproperty import FieldProperty
 
@@ -28,6 +27,7 @@
     VIEW_TAGS_SETTINGS_KEY, VIEW_THEMES_SETTINGS_KEY
 from pyams_thesaurus.interfaces.thesaurus import IThesaurus
 from pyams_utils.adapter import ContextAdapter, adapter_config, get_annotation_adapter
+from pyams_utils.factory import factory_config
 from pyams_utils.registry import get_utility, query_utility
 
 
@@ -35,7 +35,7 @@
 # Tags management
 #
 
-@implementer(IViewTagsSettings)
+@factory_config(IViewTagsSettings)
 class ViewTagsSettings(Persistent, Contained):
     """View tags settings"""
 
@@ -65,7 +65,7 @@
 @adapter_config(name='tags', context=IWfView, provides=IViewSettings)
 def view_tags_settings_factory(view):
     """View tags settings factory"""
-    return get_annotation_adapter(view, VIEW_TAGS_SETTINGS_KEY, ViewTagsSettings,
+    return get_annotation_adapter(view, VIEW_TAGS_SETTINGS_KEY, IViewTagsSettings,
                                   name='++view:tags++')
 
 
@@ -111,7 +111,7 @@
 # Themes management
 #
 
-@implementer(IViewThemesSettings)
+@factory_config(IViewThemesSettings)
 class ViewThemesSettings(Persistent, Contained):
     """View themes settings"""
 
@@ -141,7 +141,7 @@
 @adapter_config(name='themes', context=IWfView, provides=IViewSettings)
 def view_themes_settings_factory(view):
     """View themes settings factory"""
-    return get_annotation_adapter(view, VIEW_THEMES_SETTINGS_KEY, ViewThemesSettings,
+    return get_annotation_adapter(view, VIEW_THEMES_SETTINGS_KEY, IViewThemesSettings,
                                   name='++view:themes++')
 
 
@@ -166,7 +166,7 @@
 # Collections management
 #
 
-@implementer(IViewCollectionsSettings)
+@factory_config(IViewCollectionsSettings)
 class ViewCollectionsSettings(Persistent, Contained):
     """View collections settings"""
 
@@ -196,7 +196,7 @@
 @adapter_config(name='collections', context=IWfView, provides=IViewSettings)
 def view_collections_settings_factory(view):
     """View collections settings factory"""
-    return get_annotation_adapter(view, VIEW_COLLECTIONS_SETTINGS_KEY, ViewCollectionsSettings,
+    return get_annotation_adapter(view, VIEW_COLLECTIONS_SETTINGS_KEY, IViewCollectionsSettings,
                                   name='++view:collections++')