src/pyams_content/component/paragraph/__init__.py
changeset 355 5dce53509832
parent 241 50452584f7ae
child 407 0ef5de2d5674
equal deleted inserted replaced
354:871c7cb35fd6 355:5dce53509832
    45 # Auto-creation of default paragraphs
    45 # Auto-creation of default paragraphs
    46 #
    46 #
    47 
    47 
    48 @subscriber(IObjectAddedEvent, context_selector=IParagraphContainerTarget)
    48 @subscriber(IObjectAddedEvent, context_selector=IParagraphContainerTarget)
    49 def handle_new_paragraphs_container(event):
    49 def handle_new_paragraphs_container(event):
    50     """Handle new paragraphs container"""
    50     """Handle new paragraphs container
       
    51 
       
    52     Subscriber to IObjectAddedEvent for objects implementing IParagraphContainerTarget: when a
       
    53     new paragraphs container is created (in version 1), automatically create new paragraphs matching
       
    54 
       
    55     """
    51     container = IParagraphContainer(event.object)
    56     container = IParagraphContainer(event.object)
    52     if len(container) > 0:
    57     if len(container) > 0:
    53         return
    58         return
    54     content = get_parent(container, IWfSharedContent)
    59     content = get_parent(container, IWfSharedContent)
    55     version_state = IWorkflowState(content, None) if content is not None else None
    60     version_state = IWorkflowState(content, None) if content is not None else None
    74     icon_class = ''
    79     icon_class = ''
    75     icon_hint = ''
    80     icon_hint = ''
    76 
    81 
    77     visible = FieldProperty(IBaseParagraph['visible'])
    82     visible = FieldProperty(IBaseParagraph['visible'])
    78     title = FieldProperty(IBaseParagraph['title'])
    83     title = FieldProperty(IBaseParagraph['title'])
       
    84 
       
    85 
       
    86 @implementer(IParagraphFactory)
       
    87 class BaseParagraphFactory(object):
       
    88     """Base paragraph factory class"""
       
    89 
       
    90     name = None
       
    91     content_type = None
       
    92     custom_menu = False
    79 
    93 
    80 
    94 
    81 class BaseParagraphContentChecker(BaseContentChecker):
    95 class BaseParagraphContentChecker(BaseContentChecker):
    82     """Base paragraph content checker mixin"""
    96     """Base paragraph content checker mixin"""
    83 
    97