Added IInternalReferencesList support to logos paragraph
authorThierry Florac <tflorac@ulthar.net>
Tue, 17 Sep 2019 15:25:26 +0200
changeset 1347 0230c7fd71c3
parent 1346 88b5ce31afdc
child 1348 ae293e874417
Added IInternalReferencesList support to logos paragraph
src/pyams_content/shared/logo/paragraph.py
--- a/src/pyams_content/shared/logo/paragraph.py	Tue Sep 17 12:03:03 2019 +0200
+++ b/src/pyams_content/shared/logo/paragraph.py	Tue Sep 17 15:25:26 2019 +0200
@@ -10,18 +10,19 @@
 # FOR A PARTICULAR PURPOSE.
 #
 
-__docformat__ = 'restructuredtext'
-
+from zope.interface import implementer
 from zope.schema.fieldproperty import FieldProperty
 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
 
-from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory, \
-    IParagraphFactory
-from pyams_content.features.checker.interfaces import ERROR_VALUE, IContentChecker, MISSING_LANG_VALUE, MISSING_VALUE
+from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, \
+    BaseParagraphFactory, IParagraphFactory
+from pyams_content.features.checker.interfaces import ERROR_VALUE, IContentChecker, \
+    MISSING_LANG_VALUE, MISSING_VALUE
 from pyams_content.features.renderer.interfaces import IContentRenderer
-from pyams_content.shared.logo.interfaces import ILogosParagraph, LOGOS_PARAGRAPH_NAME, LOGOS_PARAGRAPH_RENDERERS, \
-    LOGOS_PARAGRAPH_TYPE
+from pyams_content.shared.logo.interfaces import ILogosParagraph, LOGOS_PARAGRAPH_NAME, \
+    LOGOS_PARAGRAPH_RENDERERS, LOGOS_PARAGRAPH_TYPE
 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
+from pyams_sequence.interfaces import IInternalReferencesList
 from pyams_sequence.reference import get_reference_target
 from pyams_utils.adapter import adapter_config
 from pyams_utils.factory import factory_config
@@ -31,10 +32,14 @@
 from pyams_utils.vocabulary import vocabulary_config
 from pyams_workflow.interfaces import IWorkflow, IWorkflowState
 
+
+__docformat__ = 'restructuredtext'
+
 from pyams_content import _
 
 
 @factory_config(ILogosParagraph)
+@implementer(IInternalReferencesList)
 class LogosParagraph(BaseParagraph):
     """Logos paragraph"""
 
@@ -51,6 +56,15 @@
             else:
                 yield get_reference_target(reference, state)
 
+    # Internal refernces interface support
+
+    @property
+    def references(self):
+        return self.logos
+
+    def get_targets(self, state=None):
+        yield from self.get_logos(state)
+
 
 @utility_config(name=LOGOS_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class LogosParagraphFactory(BaseParagraphFactory):