Removed unused gallery file attributes
authorThierry Florac <thierry.florac@onf.fr>
Mon, 24 Sep 2018 11:23:45 +0200
changeset 975 4d55824db030
parent 974 b6f60eb4346c
child 976 5d23f030767c
Removed unused gallery file attributes
src/pyams_content/component/gallery/file.py
src/pyams_content/component/gallery/interfaces/__init__.py
src/pyams_content/component/gallery/zmi/file.py
src/pyams_content/component/gallery/zmi/interfaces.py
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po
--- a/src/pyams_content/component/gallery/file.py	Fri Sep 21 17:05:52 2018 +0200
+++ b/src/pyams_content/component/gallery/file.py	Mon Sep 24 11:23:45 2018 +0200
@@ -12,32 +12,27 @@
 
 __docformat__ = 'restructuredtext'
 
-
-# import standard library
+from persistent import Persistent
+from pyramid.events import subscriber
+from pyramid.threadlocal import get_current_registry
+from zope.container.contained import Contained
+from zope.interface import alsoProvides, implementer
+from zope.lifecycleevent import ObjectModifiedEvent
+from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
+from zope.schema.fieldproperty import FieldProperty
 
-# import interfaces
 from pyams_content.component.gallery.interfaces import IGalleryFile
-from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
+from pyams_content.features.checker import BaseContentChecker
+from pyams_content.features.checker.interfaces import IContentChecker, MISSING_LANG_VALUE, MISSING_VALUE
 from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_file.interfaces import IResponsiveImage, IImage
+from pyams_file.interfaces import IImage, IResponsiveImage
+from pyams_file.property import FileProperty
 from pyams_form.interfaces.form import IFormContextPermissionChecker
 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
-from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent
-
-# import packages
-from persistent import Persistent
-from pyams_content.features.checker import BaseContentChecker
-from pyams_file.property import FileProperty
-from pyams_utils.adapter import adapter_config, ContextAdapter
+from pyams_utils.adapter import ContextAdapter, adapter_config
 from pyams_utils.registry import get_utility
 from pyams_utils.request import check_request
 from pyams_utils.traversing import get_parent
-from pyramid.events import subscriber
-from pyramid.threadlocal import get_current_registry
-from zope.lifecycleevent import ObjectModifiedEvent
-from zope.container.contained import Contained
-from zope.interface import implementer, alsoProvides
-from zope.schema.fieldproperty import FieldProperty
 
 
 #
@@ -53,8 +48,6 @@
     alt_title = FieldProperty(IGalleryFile['alt_title'])
     description = FieldProperty(IGalleryFile['description'])
     author = FieldProperty(IGalleryFile['author'])
-    author_comments = FieldProperty(IGalleryFile['author_comments'])
-    pif_number = FieldProperty(IGalleryFile['pif_number'])
     sound = FileProperty(IGalleryFile['sound'])
     sound_title = FieldProperty(IGalleryFile['sound_title'])
     sound_description = FieldProperty(IGalleryFile['sound_description'])
@@ -122,7 +115,7 @@
             langs = manager.get_languages()
         else:
             negotiator = get_utility(INegotiator)
-            langs = (negotiator.server_language, )
+            langs = (negotiator.server_language,)
         i18n = II18n(self.context)
         for lang in langs:
             for attr in ('title', 'alt_title', 'description'):
--- a/src/pyams_content/component/gallery/interfaces/__init__.py	Fri Sep 21 17:05:52 2018 +0200
+++ b/src/pyams_content/component/gallery/interfaces/__init__.py	Mon Sep 24 11:23:45 2018 +0200
@@ -12,23 +12,17 @@
 
 __docformat__ = 'restructuredtext'
 
+from zope.annotation.interfaces import IAttributeAnnotatable
+from zope.container.constraints import containers, contains
+from zope.container.interfaces import IOrderedContainer
+from zope.interface import Interface
+from zope.schema import Bool, Choice, TextLine
 
-# import standard library
-
-# import interfaces
+from pyams_content import _
 from pyams_content.component.paragraph.interfaces import IBaseParagraph
 from pyams_content.features.renderer.interfaces import IRenderedContent
-from zope.container.interfaces import IOrderedContainer
-
-# import packages
-from pyams_file.schema import MediaField, AudioField
-from pyams_i18n.schema import I18nTextLineField, I18nTextField
-from zope.annotation.interfaces import IAttributeAnnotatable
-from zope.container.constraints import contains, containers
-from zope.interface import Interface
-from zope.schema import Bool, TextLine, Choice
-
-from pyams_content import _
+from pyams_file.schema import AudioField, MediaField
+from pyams_i18n.schema import I18nTextField, I18nTextLineField
 
 
 GALLERY_CONTAINER_KEY = 'pyams_content.gallery'
@@ -62,14 +56,6 @@
                       description=_("Name of document's author"),
                       required=True)
 
-    author_comments = I18nTextField(title=_("Author's comments"),
-                                    description=_("Comments relatives to author's rights management"),
-                                    required=False)
-
-    pif_number = TextLine(title=_("Source ID"),
-                          description=_("Number used to identify media into it's original source"),
-                          required=False)
-
     sound = AudioField(title=_("Audio data"),
                        description=_("Sound file associated with the current media"),
                        required=False)
--- a/src/pyams_content/component/gallery/zmi/file.py	Fri Sep 21 17:05:52 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/file.py	Mon Sep 24 11:23:45 2018 +0200
@@ -12,45 +12,39 @@
 
 __docformat__ = 'restructuredtext'
 
-
-# import standard library
-
-# import interfaces
-from pyams_content.component.gallery.interfaces import IGallery, IGalleryFile, IGalleryParagraph, \
-    GALLERY_FILE_HIDDEN_FIELDS
-from pyams_content.component.gallery.zmi.interfaces import IGalleryMediasAddFields, IGalleryContentsView
-from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
-from pyams_file.interfaces.archive import IArchiveExtractor
-from pyams_form.interfaces.form import IFormContextPermissionChecker
-from pyams_i18n.interfaces import II18n
-from pyams_skin.interfaces.viewlet import IWidgetTitleViewletManager, IContextActions
-from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION, FORBIDDEN_PERMISSION
+from pyramid.renderers import render
+from z3c.form import field
 from z3c.form.interfaces import NOT_CHANGED
+from zope.lifecycleevent import ObjectCreatedEvent
+from zope.location import locate
 from zope.schema.interfaces import WrongType
 
-# import packages
+from pyams_content import _
 from pyams_content.component.gallery.file import GalleryFile
+from pyams_content.component.gallery.interfaces import GALLERY_FILE_HIDDEN_FIELDS, IGallery, IGalleryFile, \
+    IGalleryParagraph
+from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView, IGalleryMediasAddFields
+from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common import IWfSharedContent
 from pyams_content.shared.common.zmi import WfSharedContentPermissionMixin
 from pyams_file.file import get_magic_content_type
+from pyams_file.interfaces.archive import IArchiveExtractor
 from pyams_file.zmi.file import FilePropertiesAction
 from pyams_form.form import AJAXAddForm, ajax_config
 from pyams_form.group import NamedWidgetsGroup
+from pyams_form.interfaces.form import IFormContextPermissionChecker
+from pyams_i18n.interfaces import II18n
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.event import get_json_refresh_event
-from pyams_skin.viewlet.toolbar import ToolbarAction, JsToolbarActionItem
+from pyams_skin.interfaces.viewlet import IContextActions, IWidgetTitleViewletManager
+from pyams_skin.layer import IPyAMSLayer
+from pyams_skin.viewlet.toolbar import JsToolbarActionItem, ToolbarAction
+from pyams_utils.interfaces import FORBIDDEN_PERMISSION, VIEW_SYSTEM_PERMISSION
 from pyams_utils.registry import query_utility
 from pyams_utils.traversing import get_parent
 from pyams_utils.url import absolute_url
 from pyams_viewlet.viewlet import viewlet_config
-from pyams_zmi.form import AdminDialogEditForm, AdminDialogAddForm
-from pyramid.renderers import render
-from z3c.form import field
-from zope.lifecycleevent import ObjectCreatedEvent
-from zope.location import locate
-
-from pyams_content import _
+from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
 
 
 @viewlet_config(name='add-media.menu', context=IGallery, view=IGalleryContentsView, manager=IWidgetTitleViewletManager)
@@ -115,7 +109,6 @@
                     medias.append(media)
             for media in medias:
                 media.author = data.get('author')
-                media.author_comments = data.get('author_comments')
                 self.context.append(media)
         return None
 
@@ -191,11 +184,6 @@
         gallery = get_parent(self.context, IGallery)
         return II18n(gallery).query_attribute('title', request=self.request)
 
-    def updateWidgets(self, prefix=None):
-        super(GalleryFilePropertiesEditForm, self).updateWidgets(prefix)
-        if 'pif_number' in self.widgets:
-            self.widgets['pif_number'].input_css_class = 'col-md-3'
-
     def updateGroups(self):
         self.add_group(NamedWidgetsGroup(self, 'audio_file', self.widgets,
                                          ('sound', 'sound_title', 'sound_description'),
--- a/src/pyams_content/component/gallery/zmi/interfaces.py	Fri Sep 21 17:05:52 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/interfaces.py	Mon Sep 24 11:23:45 2018 +0200
@@ -17,13 +17,12 @@
 
 # import interfaces
 
-# import packages
-from pyams_file.schema import FileField
-from pyams_i18n.schema import I18nTextField
 from zope.interface import Interface
 from zope.schema import TextLine
 
 from pyams_content import _
+# import packages
+from pyams_file.schema import FileField
 
 
 class IGalleryContentsView(Interface):
@@ -40,7 +39,3 @@
     author = TextLine(title=_("Author"),
                       description=_("Name of document's author"),
                       required=True)
-
-    author_comments = I18nTextField(title=_("Author comments"),
-                                    description=_("Comments relatives to author's rights management"),
-                                    required=False)
Binary file src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo has changed
--- a/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Fri Sep 21 17:05:52 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Mon Sep 24 11:23:45 2018 +0200
@@ -173,7 +173,7 @@
 
 #: src/pyams_content/component/gallery/zmi/templates/gallery-medias.pt:18
 msgid "Download medias"
-msgstr "Télécharger tous les médias"
+msgstr "Enregistrer tous les médias sous..."
 
 #: src/pyams_content/component/gallery/zmi/templates/gallery-medias.pt:42
 msgid "Zoom image"