src/pyams_content/component/illustration/__init__.py
changeset 694 4541a452fd4c
parent 686 43ebbd99dd62
child 932 8e9a1496c2ba
equal deleted inserted replaced
693:26d51b558325 694:4541a452fd4c
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 
    17 
    18 # import interfaces
    18 # import interfaces
    19 from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationTarget, \
    19 from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationTarget, \
    20     ILLUSTRATION_KEY, ILLUSTRATION_RENDERERS, IBasicIllustration, IBasicIllustrationTarget, BASIC_ILLUSTRATION_KEY
    20     ILLUSTRATION_KEY, ILLUSTRATION_RENDERERS, IBasicIllustration, IBasicIllustrationTarget, BASIC_ILLUSTRATION_KEY, \
       
    21     ILinkIllustrationTarget, LINK_ILLUSTRATION_KEY, ILinkIllustration
    21 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
    22 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
    22 from pyams_file.interfaces import IFileInfo, IImage, IResponsiveImage
    23 from pyams_file.interfaces import IFileInfo, IImage, IResponsiveImage
    23 from pyams_i18n.interfaces import INegotiator, II18n, II18nManager
    24 from pyams_i18n.interfaces import INegotiator, II18n, II18nManager
    24 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent
    25 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent
    25 from zope.location.interfaces import ISublocations
    26 from zope.location.interfaces import ISublocations
   104     def illustration_callback(illustration):
   105     def illustration_callback(illustration):
   105         get_current_registry().notify(ObjectAddedEvent(illustration, context, illustration.__name__))
   106         get_current_registry().notify(ObjectAddedEvent(illustration, context, illustration.__name__))
   106 
   107 
   107     return get_annotation_adapter(context, ILLUSTRATION_KEY, Illustration,
   108     return get_annotation_adapter(context, ILLUSTRATION_KEY, Illustration,
   108                                   name='++illustration++',
   109                                   name='++illustration++',
       
   110                                   callback=illustration_callback)
       
   111 
       
   112 
       
   113 @adapter_config(context=ILinkIllustrationTarget, provides=ILinkIllustration)
       
   114 @adapter_config(name='link', context=ILinkIllustrationTarget, provides=IIllustration)
       
   115 def link_illustration_factory(context):
       
   116     """Link illustration factory"""
       
   117 
       
   118     def illustration_callback(illustration):
       
   119         get_current_registry().notify(ObjectAddedEvent(illustration, context, illustration.__name__))
       
   120 
       
   121     return get_annotation_adapter(context, LINK_ILLUSTRATION_KEY, BasicIllustration,
       
   122                                   markers=ILinkIllustration,
       
   123                                   name='++illustration++link',
   109                                   callback=illustration_callback)
   124                                   callback=illustration_callback)
   110 
   125 
   111 
   126 
   112 def update_illustration_properties(illustration):
   127 def update_illustration_properties(illustration):
   113     """Update missing file properties"""
   128     """Update missing file properties"""