--- a/src/pyams_content/component/illustration/__init__.py Fri Mar 02 13:42:41 2018 +0100
+++ b/src/pyams_content/component/illustration/__init__.py Fri Mar 02 13:48:23 2018 +0100
@@ -17,7 +17,7 @@
# import interfaces
from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationTarget, \
- ILLUSTRATION_KEY
+ ILLUSTRATION_KEY, ILLUSTRATION_RENDERERS
from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
from pyams_file.interfaces import IFileInfo, IImage, IResponsiveImage
from pyams_i18n.interfaces import INegotiator, II18n, II18nManager
@@ -29,12 +29,13 @@
# import packages
from persistent import Persistent
from pyams_content.features.checker import BaseContentChecker
-from pyams_content.features.renderer import RenderedContentMixin
+from pyams_content.features.renderer import RenderedContentMixin, IContentRenderer
from pyams_i18n.property import I18nFileProperty
from pyams_utils.adapter import adapter_config, ContextAdapter
from pyams_utils.registry import query_utility, get_utility
from pyams_utils.request import check_request
from pyams_utils.traversing import get_parent
+from pyams_utils.vocabulary import vocabulary_config
from pyramid.events import subscriber
from pyramid.threadlocal import get_current_registry
from zope.container.contained import Contained
@@ -42,6 +43,7 @@
from zope.lifecycleevent import ObjectCreatedEvent, ObjectAddedEvent
from zope.location import locate
from zope.schema.fieldproperty import FieldProperty
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
from pyams_content import _
@@ -180,3 +182,19 @@
illustration = IIllustration(context, None)
if illustration is not None:
return IContentChecker(illustration)
+
+
+@vocabulary_config(name=ILLUSTRATION_RENDERERS)
+class IllustrationRendererVocabulary(SimpleVocabulary):
+ """Illustration renderers vocabulary"""
+
+ def __init__(self, context=None):
+ request = check_request()
+ translate = request.localizer.translate
+ registry = request.registry
+ if not IIllustration.providedBy(context):
+ context = Illustration()
+ terms = [SimpleTerm(name, title=translate(adapter.label))
+ for name, adapter in sorted(registry.getAdapters((context, request), IContentRenderer),
+ key=lambda x: x[1].weight)]
+ super(IllustrationRendererVocabulary, self).__init__(terms)
--- a/src/pyams_content/component/illustration/renderer.py Fri Mar 02 13:42:41 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#
-# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.component.illustration.interfaces import ILLUSTRATION_RENDERERS
-from pyams_content.features.renderer.interfaces import IContentRenderer
-
-# import packages
-from pyams_content.component.illustration import Illustration, IIllustration
-from pyams_utils.request import check_request
-from pyams_utils.vocabulary import vocabulary_config
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-
-
-@vocabulary_config(name=ILLUSTRATION_RENDERERS)
-class IllustrationRendererVocabulary(SimpleVocabulary):
- """Illustration renderer utilities vocabulary"""
-
- def __init__(self, context=None):
- request = check_request()
- translate = request.localizer.translate
- registry = request.registry
- if not IIllustration.providedBy(context):
- context = Illustration()
- terms = [SimpleTerm(name, title=translate(adapter.label))
- for name, adapter in sorted(registry.getAdapters((context, request), IContentRenderer),
- key=lambda x: x[1].weight)]
- super(IllustrationRendererVocabulary, self).__init__(terms)