# HG changeset patch # User Thierry Florac # Date 1535981853 -7200 # Node ID 76f637363cfde158712975665a4dfed80722b0ee # Parent 5481b19fd47ce6c83efecc4621dd51280f8df847 Updated visible paragraphs iterator diff -r 5481b19fd47c -r 76f637363cfd src/pyams_content/component/paragraph/container.py --- a/src/pyams_content/component/paragraph/container.py Mon Sep 03 13:40:59 2018 +0200 +++ b/src/pyams_content/component/paragraph/container.py Mon Sep 03 15:37:33 2018 +0200 @@ -16,8 +16,8 @@ # import standard library # import interfaces -from pyams_content.component.paragraph.interfaces import IParagraphContainer, IParagraphContainerTarget, \ - PARAGRAPH_CONTAINER_KEY +from pyams_content.component.paragraph.interfaces import IParagraphFactory, IParagraphContainer, \ + IParagraphContainerTarget, PARAGRAPH_CONTAINER_KEY from pyams_content.features.checker.interfaces import IContentChecker from zope.location.interfaces import ISublocations from zope.traversing.interfaces import ITraversable @@ -26,6 +26,7 @@ from pyams_content.features.checker import BaseContentChecker from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter from pyams_utils.container import BTreeOrderedContainer +from pyams_utils.registry import get_global_registry from zope.interface import implementer from pyams_content import _ @@ -49,7 +50,11 @@ if anchors_only and not paragraph.anchor: continue if factories: - has_factory = tuple(filter(lambda x: x.content_type == paragraph.__class__)) + registry = get_global_registry() + has_factory = False + for factory_name in factories: + factory = registry.queryUtility(IParagraphFactory, name=factory_name) + has_factory = (factory is not None) and (factory.content_type == paragraph.__class__) if not has_factory: continue yield paragraph