src/pyams_content/component/paragraph/milestone.py
changeset 936 2b31cde8c028
parent 935 8a7ec586dce1
child 1094 465b273c312b
equal deleted inserted replaced
930:814f7c5e04d1 936:2b31cde8c028
    13 __docformat__ = 'restructuredtext'
    13 __docformat__ = 'restructuredtext'
    14 
    14 
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 from persistent import Persistent
    17 from persistent import Persistent
    18 
    18 from pyramid.events import subscriber
       
    19 from zope.container.contained import Contained
       
    20 from zope.container.ordered import OrderedContainer
       
    21 from zope.interface import implementer
       
    22 from zope.lifecycleevent import ObjectModifiedEvent
       
    23 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
       
    24 from zope.location import locate
       
    25 from zope.location.interfaces import ISublocations
       
    26 from zope.schema.fieldproperty import FieldProperty
       
    27 from zope.traversing.interfaces import ITraversable
       
    28 
       
    29 # import interfaces
       
    30 from pyams_catalog.utils import index_object
       
    31 from pyams_content import _
       
    32 from pyams_content.component.paragraph import BaseParagraph, BaseParagraphFactory, BaseParagraphContentChecker
    19 # import packages
    33 # import packages
    20 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
    34 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
    21     IParagraphFactory
    35     IParagraphFactory
    22 from pyams_content.component.paragraph.interfaces.milestone import IMilestone, IMilestoneContainer, \
    36 from pyams_content.component.paragraph.interfaces.milestone import IMilestone, IMilestoneContainer, \
    23     IMilestoneContainerTarget, MILESTONE_CONTAINER_KEY, IMilestoneParagraph, MILESTONE_PARAGRAPH_TYPE, \
    37     IMilestoneContainerTarget, MILESTONE_CONTAINER_KEY, IMilestoneParagraph, MILESTONE_PARAGRAPH_TYPE, \
    24     MILESTONE_PARAGRAPH_RENDERERS, MILESTONE_PARAGRAPH_NAME
    38     MILESTONE_PARAGRAPH_RENDERERS, MILESTONE_PARAGRAPH_NAME
       
    39 from pyams_content.features.checker import BaseContentChecker
    25 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE
    40 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE
       
    41 from pyams_content.features.renderer import RenderersVocabulary
    26 from pyams_form.interfaces.form import IFormContextPermissionChecker
    42 from pyams_form.interfaces.form import IFormContextPermissionChecker
    27 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
    43 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
    28 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
       
    29 from zope.location.interfaces import ISublocations
       
    30 from zope.traversing.interfaces import ITraversable
       
    31 
       
    32 # import interfaces
       
    33 from pyams_catalog.utils import index_object
       
    34 from pyams_content.component.paragraph import BaseParagraph, BaseParagraphFactory, BaseParagraphContentChecker
       
    35 from pyams_content.features.checker import BaseContentChecker
       
    36 from pyams_content.features.renderer import RenderersVocabulary
       
    37 from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter
    44 from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter
    38 from pyams_utils.factory import factory_config
    45 from pyams_utils.factory import factory_config
    39 from pyams_utils.registry import get_current_registry, get_utility, utility_config
    46 from pyams_utils.registry import get_current_registry, get_utility, utility_config
    40 from pyams_utils.request import check_request
    47 from pyams_utils.request import check_request
    41 from pyams_utils.traversing import get_parent
    48 from pyams_utils.traversing import get_parent
    42 from pyams_utils.vocabulary import vocabulary_config
    49 from pyams_utils.vocabulary import vocabulary_config
    43 from pyramid.events import subscriber
       
    44 from zope.container.contained import Contained
       
    45 from zope.container.ordered import OrderedContainer
       
    46 from zope.interface import implementer
       
    47 from zope.lifecycleevent import ObjectCreatedEvent, ObjectModifiedEvent
       
    48 from zope.location import locate
       
    49 from zope.schema.fieldproperty import FieldProperty
       
    50 
       
    51 from pyams_content import _
       
    52 
    50 
    53 
    51 
    54 #
    52 #
    55 # Milestone class and adapters
    53 # Milestone class and adapters
    56 #
    54 #
   219     """Milestones paragraph"""
   217     """Milestones paragraph"""
   220 
   218 
   221     icon_class = 'fa-arrows-h'
   219     icon_class = 'fa-arrows-h'
   222     icon_hint = MILESTONE_PARAGRAPH_NAME
   220     icon_hint = MILESTONE_PARAGRAPH_NAME
   223 
   221 
       
   222     body = FieldProperty(IMilestoneParagraph['body'])
   224     renderer = FieldProperty(IMilestoneParagraph['renderer'])
   223     renderer = FieldProperty(IMilestoneParagraph['renderer'])
   225 
   224 
   226 
   225 
   227 @utility_config(name=MILESTONE_PARAGRAPH_TYPE, provides=IParagraphFactory)
   226 @utility_config(name=MILESTONE_PARAGRAPH_TYPE, provides=IParagraphFactory)
   228 class MilestoneParagraphFactory(BaseParagraphFactory):
   227 class MilestoneParagraphFactory(BaseParagraphFactory):