# HG changeset patch # User Thierry Florac # Date 1537453462 -7200 # Node ID 1be26c1585fd3042ba448077a375f89d3478facb # Parent a3d8d83fb6f0c4dba810a95d0c5995ad6694f8d1 Reordered attributes diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/illustration/interfaces/__init__.py --- a/src/pyams_content/component/illustration/interfaces/__init__.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/illustration/interfaces/__init__.py Thu Sep 20 16:24:22 2018 +0200 @@ -12,16 +12,11 @@ __docformat__ = 'restructuredtext' - -# import standard library - from zope.annotation.interfaces import IAttributeAnnotatable -# import packages from zope.interface import Interface from zope.schema import Choice, TextLine from pyams_content import _ -# import interfaces from pyams_content.component.paragraph.interfaces import IBaseParagraph from pyams_content.features.renderer.interfaces import IRenderedContent from pyams_i18n.schema import I18nTextLineField, I18nTextField, I18nThumbnailMediaField diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/illustration/zmi/__init__.py --- a/src/pyams_content/component/illustration/zmi/__init__.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/illustration/zmi/__init__.py Thu Sep 20 16:24:22 2018 +0200 @@ -12,30 +12,25 @@ __docformat__ = 'restructuredtext' +from transaction.interfaces import ITransactionManager +from z3c.form import field -# import standard library - -# import interfaces +from pyams_content import _ from pyams_content.component.illustration.interfaces import IBasicIllustration, IBasicIllustrationTarget, \ IIllustration, IIllustrationTarget, ILinkIllustrationTarget -from pyams_content.component.paragraph import IBaseParagraph -from pyams_form.interfaces.form import IInnerSubForm, IWidgetsPrefixViewletsManager -from pyams_skin.layer import IPyAMSLayer -from pyams_zmi.interfaces import IPropertiesEditForm -from transaction.interfaces import ITransactionManager - # import packages from pyams_content.component.illustration.zmi.paragraph import ParagraphContainerIllustrationMarker +from pyams_content.component.paragraph import IBaseParagraph from pyams_content.component.paragraph.zmi import get_json_paragraph_markers_refresh_event from pyams_content.features.renderer.zmi.widget import RendererFieldWidget +from pyams_form.interfaces.form import IInnerSubForm, IWidgetsPrefixViewletsManager from pyams_skin.event import get_json_form_refresh_event, get_json_widget_refresh_event +from pyams_skin.layer import IPyAMSLayer from pyams_template.template import template_config from pyams_utils.adapter import adapter_config from pyams_viewlet.viewlet import viewlet_config, Viewlet, EmptyViewlet from pyams_zmi.form import InnerAdminEditForm -from z3c.form import field - -from pyams_content import _ +from pyams_zmi.interfaces import IPropertiesEditForm # diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/illustration/zmi/paragraph.py --- a/src/pyams_content/component/illustration/zmi/paragraph.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/illustration/zmi/paragraph.py Thu Sep 20 16:24:22 2018 +0200 @@ -12,40 +12,35 @@ __docformat__ = 'restructuredtext' - -# import standard library - -# import interfaces -from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, \ - IParagraphContainer -from pyams_content.component.illustration.interfaces import IIllustrationTarget, IIllustration, \ - IIllustrationParagraph, ILLUSTRATION_PARAGRAPH_TYPE -from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView, \ - IParagraphContainerTable, IParagraphTitleToolbar -from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION -from pyams_form.interfaces.form import IInnerForm -from pyams_skin.interfaces.viewlet import IToolbarAddingMenu -from pyams_skin.layer import IPyAMSLayer -from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION from transaction.interfaces import ITransactionManager +from z3c.form import field, button from z3c.form.interfaces import INPUT_MODE - -# import packages -from pyams_content.component.illustration.paragraph import Illustration -from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \ - BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons -from pyams_content.features.renderer.zmi.widget import RendererFieldWidget -from pyams_form.form import ajax_config -from pyams_pagelet.pagelet import pagelet_config -from pyams_skin.event import get_json_form_refresh_event -from pyams_template.template import template_config -from pyams_utils.adapter import adapter_config -from pyams_viewlet.viewlet import viewlet_config, Viewlet -from pyams_zmi.form import AdminDialogAddForm -from z3c.form import field, button from zope.interface import implementer from pyams_content import _ +from pyams_content.component.illustration.interfaces import IIllustrationTarget, IIllustration, \ + IIllustrationParagraph, ILLUSTRATION_PARAGRAPH_TYPE +# import packages +from pyams_content.component.illustration.paragraph import Illustration +from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, \ + IParagraphContainer +from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \ + BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons +from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView, \ + IParagraphContainerTable, IParagraphTitleToolbar +from pyams_content.features.renderer.zmi.widget import RendererFieldWidget +from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION +from pyams_form.form import ajax_config +from pyams_form.interfaces.form import IInnerForm +from pyams_pagelet.pagelet import pagelet_config +from pyams_skin.event import get_json_form_refresh_event +from pyams_skin.interfaces.viewlet import IToolbarAddingMenu +from pyams_skin.layer import IPyAMSLayer +from pyams_template.template import template_config +from pyams_utils.adapter import adapter_config +from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION +from pyams_viewlet.viewlet import viewlet_config, Viewlet +from pyams_zmi.form import AdminDialogAddForm # @@ -74,8 +69,8 @@ dialog_class = 'modal-large' icon_css_class = 'fa fa-fw fa-file-image-o' - fields = field.Fields(IIllustrationParagraph).select('data', 'title', 'alt_title', 'description', - 'author', 'renderer') + fields = field.Fields(IIllustrationParagraph).select('data', 'title', 'alt_title', + 'author', 'description', 'renderer') edit_permission = MANAGE_CONTENT_PERMISSION @@ -99,8 +94,8 @@ dialog_class = 'modal-large' icon_css_class = 'fa fa-fw fa-file-image-o' - fields = field.Fields(IIllustrationParagraph).select('data', 'title', 'alt_title', 'description', - 'author', 'renderer') + fields = field.Fields(IIllustrationParagraph).select('data', 'title', 'alt_title', + 'author', 'description', 'renderer') fields['renderer'].widgetFactory = RendererFieldWidget edit_permission = MANAGE_CONTENT_PERMISSION diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/paragraph/audio.py --- a/src/pyams_content/component/paragraph/audio.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/paragraph/audio.py Thu Sep 20 16:24:22 2018 +0200 @@ -15,25 +15,25 @@ # import standard library +from zope.interface import implementer +from zope.schema.fieldproperty import FieldProperty + # import interfaces from pyams_content.component.illustration.interfaces import IBasicIllustrationTarget +# import packages +from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory from pyams_content.component.paragraph.interfaces import IParagraphFactory from pyams_content.component.paragraph.interfaces.audio import IAudioParagraph, AUDIO_PARAGRAPH_TYPE, \ AUDIO_PARAGRAPH_RENDERERS, AUDIO_PARAGRAPH_NAME from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE -from pyams_i18n.interfaces import II18nManager, INegotiator, II18n - -# import packages -from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory from pyams_content.features.renderer import RenderersVocabulary from pyams_file.property import FileProperty +from pyams_i18n.interfaces import II18nManager, INegotiator, II18n from pyams_utils.adapter import adapter_config from pyams_utils.factory import factory_config from pyams_utils.registry import utility_config, get_utility from pyams_utils.traversing import get_parent from pyams_utils.vocabulary import vocabulary_config -from zope.interface import implementer -from zope.schema.fieldproperty import FieldProperty @implementer(IAudioParagraph, IBasicIllustrationTarget) @@ -45,8 +45,8 @@ icon_hint = AUDIO_PARAGRAPH_NAME data = FileProperty(IAudioParagraph['data']) + author = FieldProperty(IAudioParagraph['author']) description = FieldProperty(IAudioParagraph['description']) - author = FieldProperty(IAudioParagraph['author']) renderer = FieldProperty(IAudioParagraph['renderer']) diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/paragraph/interfaces/audio.py --- a/src/pyams_content/component/paragraph/interfaces/audio.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/paragraph/interfaces/audio.py Thu Sep 20 16:24:22 2018 +0200 @@ -15,16 +15,14 @@ # import standard library +from zope.schema import TextLine, Choice + +from pyams_content import _ # import interfaces from pyams_content.component.paragraph.interfaces import IBaseParagraph - # import packages from pyams_file.schema import AudioField from pyams_i18n.schema import I18nTextField, I18nTextLineField -from zope.schema import TextLine, Choice - -from pyams_content import _ - # # Audio paragraph @@ -45,14 +43,14 @@ title = I18nTextLineField(title=_("Legend"), required=False) + author = TextLine(title=_("Author"), + description=_("Name of document's author"), + required=False) + description = I18nTextField(title=_("Description"), description=_("File description displayed by front-office template"), required=False) - author = TextLine(title=_("Author"), - description=_("Name of document's author"), - required=False) - renderer = Choice(title=_("Audio template"), description=_("Presentation template used for this audio file"), vocabulary=AUDIO_PARAGRAPH_RENDERERS, diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/paragraph/interfaces/video.py --- a/src/pyams_content/component/paragraph/interfaces/video.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/paragraph/interfaces/video.py Thu Sep 20 16:24:22 2018 +0200 @@ -15,16 +15,14 @@ # import standard library +from zope.schema import TextLine, Choice + +from pyams_content import _ # import interfaces from pyams_content.component.paragraph.interfaces import IBaseParagraph - # import packages from pyams_file.schema import VideoField from pyams_i18n.schema import I18nTextField, I18nTextLineField -from zope.schema import TextLine, Choice - -from pyams_content import _ - # # HTML paragraph @@ -45,14 +43,14 @@ title = I18nTextLineField(title=_("Legend"), required=False) + author = TextLine(title=_("Author"), + description=_("Name of document's author"), + required=True) + description = I18nTextField(title=_("Associated text"), description=_("Video description displayed by front-office template"), required=False) - author = TextLine(title=_("Author"), - description=_("Name of document's author"), - required=True) - renderer = Choice(title=_("Video template"), description=_("Presentation template used for this video"), vocabulary=VIDEO_PARAGRAPH_RENDERERS, diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/paragraph/video.py --- a/src/pyams_content/component/paragraph/video.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/paragraph/video.py Thu Sep 20 16:24:22 2018 +0200 @@ -15,24 +15,24 @@ # import standard library +from zope.interface import implementer +from zope.schema.fieldproperty import FieldProperty + +# import packages +from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory # import interfaces from pyams_content.component.paragraph.interfaces import IParagraphFactory from pyams_content.component.paragraph.interfaces.video import IVideoParagraph, VIDEO_PARAGRAPH_TYPE, \ VIDEO_PARAGRAPH_RENDERERS, VIDEO_PARAGRAPH_NAME from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE -from pyams_i18n.interfaces import II18nManager, INegotiator, II18n - -# import packages -from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory from pyams_content.features.renderer import RenderersVocabulary from pyams_file.property import FileProperty +from pyams_i18n.interfaces import II18nManager, INegotiator, II18n from pyams_utils.adapter import adapter_config from pyams_utils.factory import factory_config from pyams_utils.registry import utility_config, get_utility from pyams_utils.traversing import get_parent from pyams_utils.vocabulary import vocabulary_config -from zope.interface import implementer -from zope.schema.fieldproperty import FieldProperty @implementer(IVideoParagraph) @@ -44,8 +44,8 @@ icon_hint = VIDEO_PARAGRAPH_NAME data = FileProperty(IVideoParagraph['data']) + author = FieldProperty(IVideoParagraph['author']) description = FieldProperty(IVideoParagraph['description']) - author = FieldProperty(IVideoParagraph['author']) renderer = FieldProperty(IVideoParagraph['renderer']) diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/video/__init__.py --- a/src/pyams_content/component/video/__init__.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/video/__init__.py Thu Sep 20 16:24:22 2018 +0200 @@ -12,33 +12,27 @@ __docformat__ = 'restructuredtext' - -# import standard library from persistent import Persistent - -# import interfaces -from pyams_content.component.video.interfaces import IExternalVideo, IExternalVideoProvider, IExternalVideoSettings -from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE -from pyams_i18n.interfaces import II18nManager, INegotiator, II18n - -# import packages -from pyams_content.features.checker import BaseContentChecker, VALUE_OK -from pyams_utils.adapter import adapter_config, get_annotation_adapter -from pyams_utils.registry import query_utility, get_utility -from pyams_utils.traversing import get_parent from zope.container.contained import Contained from zope.interface import implementer from zope.schema.fieldproperty import FieldProperty from pyams_content import _ +from pyams_content.component.video.interfaces import IExternalVideo, IExternalVideoProvider, IExternalVideoSettings +from pyams_content.features.checker import BaseContentChecker, VALUE_OK +from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE +from pyams_i18n.interfaces import II18nManager, INegotiator, II18n +from pyams_utils.adapter import adapter_config, get_annotation_adapter +from pyams_utils.registry import query_utility, get_utility +from pyams_utils.traversing import get_parent @implementer(IExternalVideo) class ExternalVideo(Persistent, Contained): """External video persistent class""" + author = FieldProperty(IExternalVideo['author']) description = FieldProperty(IExternalVideo['description']) - author = FieldProperty(IExternalVideo['author']) provider_name = FieldProperty(IExternalVideo['provider_name']) def get_provider(self): diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/video/interfaces/__init__.py --- a/src/pyams_content/component/video/interfaces/__init__.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/video/interfaces/__init__.py Thu Sep 20 16:24:22 2018 +0200 @@ -12,20 +12,14 @@ __docformat__ = 'restructuredtext' - -# import standard library - -# import interfaces -from pyams_content.component.paragraph.interfaces import IBaseParagraph from zope.annotation import IAttributeAnnotatable from zope.contentprovider.interfaces import IContentProvider - -# import packages -from pyams_i18n.schema import I18nTextField, I18nTextLineField from zope.interface import Interface, Attribute from zope.schema import Choice, TextLine from pyams_content import _ +from pyams_content.component.paragraph.interfaces import IBaseParagraph +from pyams_i18n.schema import I18nTextField, I18nTextLineField class IExternalVideoSettings(Interface): @@ -45,14 +39,14 @@ class IExternalVideo(IAttributeAnnotatable): """Base interface for external video integration""" + author = TextLine(title=_("Author"), + description=_("Name of document's author"), + required=True) + description = I18nTextField(title=_("Associated text"), description=_("Video description displayed by front-office template"), required=False) - author = TextLine(title=_("Author"), - description=_("Name of document's author"), - required=True) - provider_name = Choice(title=_("Video provider"), description=_("Name of external platform providing selected video"), required=False, diff -r a3d8d83fb6f0 -r 1be26c1585fd src/pyams_content/component/video/zmi/paragraph.py --- a/src/pyams_content/component/video/zmi/paragraph.py Thu Sep 20 10:48:36 2018 +0200 +++ b/src/pyams_content/component/video/zmi/paragraph.py Thu Sep 20 16:24:22 2018 +0200 @@ -12,45 +12,39 @@ __docformat__ = 'restructuredtext' - -# import standard library - -# import interfaces -from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer -from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView, IParagraphInnerEditor -from pyams_content.component.video.interfaces import IExternalVideoProvider, IExternalVideoSettings, \ - IExternalVideoParagraph, EXTERNAL_VIDEO_PARAGRAPH_TYPE -from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION -from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager, IInnerForm -from pyams_skin.interfaces.viewlet import IToolbarAddingMenu -from pyams_skin.layer import IPyAMSLayer -from pyams_utils.interfaces.data import IObjectData -from z3c.form.interfaces import DISPLAY_MODE, INPUT_MODE, IDataExtractedEvent - -# import packages -from pyams_content.component.paragraph.zmi import BaseParagraphAddMenu, BaseParagraphAJAXAddForm, \ - BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, get_json_paragraph_refresh_event, \ - IParagraphEditFormButtons -from pyams_content.component.video.paragraph import ExternalVideoParagraph -from pyams_content.features.renderer.zmi.widget import RendererFieldWidget -from pyams_form.form import ajax_config -from pyams_form.group import NamedWidgetsGroup -from pyams_pagelet.pagelet import pagelet_config -from pyams_template.template import template_config -from pyams_utils.adapter import adapter_config -from pyams_utils.registry import get_utility -from pyams_utils.url import absolute_url -from pyams_viewlet.viewlet import viewlet_config, Viewlet -from pyams_zmi.form import AdminDialogAddForm, InnerAdminAddForm, InnerAdminEditForm from pyramid.events import subscriber from pyramid.exceptions import NotFound from pyramid.response import Response from pyramid.view import view_config from z3c.form import field, button +from z3c.form.interfaces import DISPLAY_MODE, INPUT_MODE, IDataExtractedEvent from zope.interface import implementer, alsoProvides, Interface, Invalid from zope.schema import getFieldNamesInOrder from pyams_content import _ +from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer +from pyams_content.component.paragraph.zmi import BaseParagraphAddMenu, BaseParagraphAJAXAddForm, \ + BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, get_json_paragraph_refresh_event, \ + IParagraphEditFormButtons +from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView, IParagraphInnerEditor +from pyams_content.component.video.interfaces import IExternalVideoProvider, IExternalVideoSettings, \ + IExternalVideoParagraph, EXTERNAL_VIDEO_PARAGRAPH_TYPE +from pyams_content.component.video.paragraph import ExternalVideoParagraph +from pyams_content.features.renderer.zmi.widget import RendererFieldWidget +from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION +from pyams_form.form import ajax_config +from pyams_form.group import NamedWidgetsGroup +from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager, IInnerForm +from pyams_pagelet.pagelet import pagelet_config +from pyams_skin.interfaces.viewlet import IToolbarAddingMenu +from pyams_skin.layer import IPyAMSLayer +from pyams_template.template import template_config +from pyams_utils.adapter import adapter_config +from pyams_utils.interfaces.data import IObjectData +from pyams_utils.registry import get_utility +from pyams_utils.url import absolute_url +from pyams_viewlet.viewlet import viewlet_config, Viewlet +from pyams_zmi.form import AdminDialogAddForm, InnerAdminAddForm, InnerAdminEditForm @viewlet_config(name='add-external-video.menu', context=IParagraphContainerTarget, view=IParagraphContainerView, @@ -75,7 +69,7 @@ dialog_class = 'modal-large' icon_css_class = 'fa fa-fw fa-youtube-play' - fields = field.Fields(IExternalVideoParagraph).select('title', 'description', 'author', 'renderer', 'provider_name') + fields = field.Fields(IExternalVideoParagraph).select('title', 'author', 'description', 'renderer', 'provider_name') edit_permission = MANAGE_CONTENT_PERMISSION def updateWidgets(self, prefix=None): @@ -192,7 +186,7 @@ @property def fields(self): - fields = field.Fields(IExternalVideoParagraph).select('title', 'description', 'author', 'renderer', + fields = field.Fields(IExternalVideoParagraph).select('title', 'author', 'description', 'renderer', 'provider_name') fields['renderer'].widgetFactory = RendererFieldWidget provider = self.context.get_provider() @@ -238,7 +232,7 @@ base=BaseParagraphAJAXEditForm) @implementer(IInnerForm) class ExternalVideoParagraphInnerEditForm(ExternalVideoParagraphPropertiesEditForm): - """External video paragraph properties inner deit form""" + """External video paragraph properties inner edit form""" legend = None