src/pyams_content/shared/news/manager.py
changeset 139 99a481dc4c89
parent 0 7c0001cacf8e
child 192 8a16d2f507d7
equal deleted inserted replaced
138:1643b6a9a02a 139:99a481dc4c89
    14 
    14 
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 
    17 
    18 # import interfaces
    18 # import interfaces
       
    19 from pyams_content.component.paragraph.interfaces import IParagraphFactorySettings
    19 from pyams_content.component.theme.interfaces import IThemesManagerTarget
    20 from pyams_content.component.theme.interfaces import IThemesManagerTarget
    20 from pyams_content.shared.news.interfaces import INewsManager, NEWS_CONTENT_TYPE
    21 from pyams_content.shared.news.interfaces import INewsManager, NEWS_CONTENT_TYPE
    21 from zope.annotation.interfaces import IAttributeAnnotatable
    22 from zope.annotation.interfaces import IAttributeAnnotatable
    22 from zope.component.interfaces import ISite
    23 from zope.component.interfaces import ISite
    23 from zope.lifecycleevent.interfaces import IObjectAddedEvent
    24 from zope.lifecycleevent.interfaces import IObjectAddedEvent
    26 from pyams_content.shared.common.manager import SharedTool
    27 from pyams_content.shared.common.manager import SharedTool
    27 from pyams_content.shared.news import NewsEvent
    28 from pyams_content.shared.news import NewsEvent
    28 from pyams_utils.traversing import get_parent
    29 from pyams_utils.traversing import get_parent
    29 from pyramid.events import subscriber
    30 from pyramid.events import subscriber
    30 from zope.interface import implementer
    31 from zope.interface import implementer
       
    32 from zope.schema.fieldproperty import FieldProperty
    31 
    33 
    32 
    34 
    33 @implementer(INewsManager, IThemesManagerTarget, IAttributeAnnotatable)
    35 @implementer(INewsManager, IParagraphFactorySettings, IThemesManagerTarget, IAttributeAnnotatable)
    34 class NewsManager(SharedTool):
    36 class NewsManager(SharedTool):
    35     """News manager class"""
    37     """News manager class"""
    36 
    38 
    37     shared_content_type = NEWS_CONTENT_TYPE
    39     shared_content_type = NEWS_CONTENT_TYPE
    38     shared_content_factory = NewsEvent
    40     shared_content_factory = NewsEvent
       
    41 
       
    42     auto_created_paragraphs = FieldProperty(IParagraphFactorySettings['auto_created_paragraphs'])
    39 
    43 
    40 
    44 
    41 @subscriber(IObjectAddedEvent, context_selector=INewsManager)
    45 @subscriber(IObjectAddedEvent, context_selector=INewsManager)
    42 def handle_added_news_manager(event):
    46 def handle_added_news_manager(event):
    43     """Register news manager when added"""
    47     """Register news manager when added"""