Formatting...
authorThierry Florac <tflorac@ulthar.net>
Wed, 01 Jul 2020 14:10:50 +0200
changeset 1393 9479901b53a5
parent 1392 1d8fd5a53ced
child 1394 ed31bfceddda
Formatting...
src/pyams_content/shared/common/__init__.py
src/pyams_content/shared/site/zmi/container.py
--- a/src/pyams_content/shared/common/__init__.py	Mon Jun 29 22:50:00 2020 +0200
+++ b/src/pyams_content/shared/common/__init__.py	Wed Jul 01 14:10:50 2020 +0200
@@ -25,12 +25,15 @@
 from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
 
 from pyams_content.features.checker import BaseContentChecker
-from pyams_content.features.checker.interfaces import ERROR_VALUE, IContentChecker, MISSING_LANG_VALUE, MISSING_VALUE
+from pyams_content.features.checker.interfaces import ERROR_VALUE, IContentChecker, \
+    MISSING_LANG_VALUE, MISSING_VALUE
 from pyams_content.features.review.interfaces import IReviewComments
-from pyams_content.interfaces import CONTRIBUTOR_ROLE, GUEST_ROLE, IBaseContentInfo, MANAGER_ROLE, OWNER_ROLE, \
-    READER_ROLE
-from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY, IBaseSharedTool, ISharedContent, \
-    ISharedSite, IWfSharedContent, IWfSharedContentFactory, IWfSharedContentRoles, SHARED_CONTENT_TYPES_VOCABULARY
+from pyams_content.interfaces import CONTRIBUTOR_ROLE, GUEST_ROLE, IBaseContentInfo, \
+    MANAGER_ROLE, OWNER_ROLE, READER_ROLE
+from pyams_content.shared.common.interfaces import CONTENT_TYPES_VOCABULARY, IBaseSharedTool, \
+    ISharedContent, ISharedSite, IWfSharedContent, IWfSharedContentFactory, \
+    IWfSharedContentRoles, SHARED_CONTENT_TYPES_VOCABULARY
+from pyams_content.shared.common.interfaces.zmi import IDashboardTypeColumnValue
 from pyams_i18n.content import I18nManagerMixin
 from pyams_i18n.interfaces import II18n, II18nManager
 from pyams_portal.interfaces import DESIGNER_ROLE
@@ -49,8 +52,8 @@
 from pyams_utils.traversing import get_parent
 from pyams_utils.vocabulary import vocabulary_config
 from pyams_utils.zodb import volatile_property
-from pyams_workflow.interfaces import IObjectClonedEvent, IWorkflow, IWorkflowPublicationSupport, \
-    IWorkflowTransitionEvent, IWorkflowVersions
+from pyams_workflow.interfaces import IObjectClonedEvent, IWorkflow, \
+    IWorkflowPublicationSupport, IWorkflowTransitionEvent, IWorkflowVersions
 
 
 __docformat__ = 'restructuredtext'
@@ -66,9 +69,10 @@
 
     def __init__(self, context):
         request = query_request()
-        super(SharedSiteVocabulary, self).__init__([SimpleTerm(v, title=II18n(t).query_attribute('title',
-                                                                                                 request=request))
-                                                    for v, t in get_utilities_for(self.interface)])
+        super(SharedSiteVocabulary, self).__init__(
+            [SimpleTerm(v, title=II18n(t).query_attribute('title',
+                                                          request=request))
+             for v, t in get_utilities_for(self.interface)])
 
 
 #
@@ -133,11 +137,13 @@
 # Workflow shared content class and adapters
 #
 
-@implementer(IDefaultProtectionPolicy, IWfSharedContent, IWfSharedContentRoles, IWorkflowPublicationSupport)
+@implementer(IDefaultProtectionPolicy, IWfSharedContent, IWfSharedContentRoles,
+             IWorkflowPublicationSupport)
 class WfSharedContent(ProtectedObject, Persistent, Contained, I18nManagerMixin):
     """Shared data content class"""
 
-    __roles__ = (OWNER_ROLE, MANAGER_ROLE, CONTRIBUTOR_ROLE, DESIGNER_ROLE, READER_ROLE, GUEST_ROLE)
+    __roles__ = (OWNER_ROLE, MANAGER_ROLE, CONTRIBUTOR_ROLE, DESIGNER_ROLE, READER_ROLE,
+                 GUEST_ROLE)
     roles_interface = IWfSharedContentRoles
 
     owner = RolePrincipalsFieldProperty(IWfSharedContentRoles['owner'])
@@ -279,20 +285,24 @@
                 value = i18n.get_attribute(attr, lang, request)
                 if not value:
                     if len(langs) == 1:
-                        output.append(missing_value.format(field=translate(IWfSharedContent[attr].title)))
+                        output.append(
+                            missing_value.format(field=translate(IWfSharedContent[attr].title)))
                     else:
-                        output.append(missing_lang_value.format(field=translate(IWfSharedContent[attr].title),
-                                                                lang=lang))
+                        output.append(missing_lang_value.format(
+                            field=translate(IWfSharedContent[attr].title),
+                            lang=lang))
                 else:
                     length = len(value)
                     if (attr == 'title') and (length < 40 or length > 66):
                         output.append(translate(ERROR_VALUE).format(
                             field=translate(IWfSharedContent[attr].title),
-                            message=translate(_("title length should be between 40 and 66 characters ({length} "
-                                                "actually)")).format(length=length)
+                            message=translate(
+                                _("title length should be between 40 and 66 characters ({length} "
+                                  "actually)")).format(length=length)
                         ))
         if not self.context.keywords:
-            output.append(missing_value.format(field=translate(IWfSharedContent['keywords'].title)))
+            output.append(
+                missing_value.format(field=translate(IWfSharedContent['keywords'].title)))
         return output
 
 
--- a/src/pyams_content/shared/site/zmi/container.py	Mon Jun 29 22:50:00 2020 +0200
+++ b/src/pyams_content/shared/site/zmi/container.py	Wed Jul 01 14:10:50 2020 +0200
@@ -454,7 +454,8 @@
                 title=name or super(SiteContainerTreeNameColumn, self).renderCell(item))
 
 
-@adapter_config(name='content-type', context=(IBaseSiteItem, IPyAMSLayer, ISiteTreeTable), provides=IColumn)
+@adapter_config(name='content-type', context=(IBaseSiteItem, IPyAMSLayer, ISiteTreeTable),
+                provides=IColumn)
 class SiteContainerContentTypeColumn(I18nColumn, GetAttrColumn):
     """Site container content type column"""
 
@@ -466,7 +467,8 @@
         return self.request.localizer.translate(obj.content_name)
 
 
-@adapter_config(name='sequence', context=(IBaseSiteItem, IPyAMSLayer, ISiteTreeTable), provides=IColumn)
+@adapter_config(name='sequence', context=(IBaseSiteItem, IPyAMSLayer, ISiteTreeTable),
+                provides=IColumn)
 class SiteContainerTreeSequenceColumn(SharedToolDashboardSequenceColumn):
     """Site container tree OID column"""