diff -r 120ce09ade94 -r 8e8a14452567 src/pyams_content/component/paragraph/pictogram.py --- a/src/pyams_content/component/paragraph/pictogram.py Thu May 24 10:51:45 2018 +0200 +++ b/src/pyams_content/component/paragraph/pictogram.py Fri May 25 08:03:41 2018 +0200 @@ -23,7 +23,6 @@ IPictogramContainer, PICTOGRAM_CONTAINER_KEY, IPictogramParagraph, PICTOGRAM_PARAGRAPH_TYPE, \ PICTOGRAM_PARAGRAPH_RENDERERS from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE -from pyams_content.features.renderer.interfaces import IContentRenderer from pyams_content.reference.pictograms.interfaces import IPictogramTable from pyams_form.interfaces.form import IFormContextPermissionChecker from pyams_i18n.interfaces import II18n, II18nManager, INegotiator @@ -36,8 +35,9 @@ from pyams_catalog.utils import index_object from pyams_content.component.paragraph import BaseParagraph, BaseParagraphFactory, BaseParagraphContentChecker from pyams_content.features.checker import BaseContentChecker -from pyams_content.features.renderer import RenderedContentMixin +from pyams_content.features.renderer import RenderersVocabulary from pyams_utils.adapter import adapter_config, ContextAdapter +from pyams_utils.factory import factory_config from pyams_utils.registry import query_utility, get_current_registry, get_utility, utility_config from pyams_utils.request import check_request from pyams_utils.traversing import get_parent @@ -49,7 +49,6 @@ from zope.interface import implementer from zope.location import locate from zope.schema.fieldproperty import FieldProperty -from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from pyams_content import _ @@ -212,7 +211,8 @@ @implementer(IPictogramParagraph, IIllustrationTarget) -class PictogramParagraph(RenderedContentMixin, BaseParagraph): +@factory_config(provided=IPictogramParagraph) +class PictogramParagraph(BaseParagraph): """Pictograms paragraph""" icon_class = 'fa-linode' @@ -262,16 +262,7 @@ @vocabulary_config(name=PICTOGRAM_PARAGRAPH_RENDERERS) -class PictogramParagraphRendererVocabulary(SimpleVocabulary): +class PictogramParagraphRendererVocabulary(RenderersVocabulary): """Pictograms paragraph renderers vocabulary""" - def __init__(self, context=None): - request = check_request() - translate = request.localizer.translate - registry = request.registry - if not IPictogramParagraph.providedBy(context): - context = PictogramParagraph() - terms = [SimpleTerm(name, title=translate(adapter.label)) - for name, adapter in sorted(registry.getAdapters((context, request), IContentRenderer), - key=lambda x: x[1].weight)] - super(PictogramParagraphRendererVocabulary, self).__init__(terms) + content_interface = IPictogramParagraph