PEP coding style...
--- a/src/pyams_content/component/video/provider/__init__.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/component/video/provider/__init__.py Thu Sep 20 10:48:36 2018 +0200
@@ -9,32 +9,25 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from zope.component._api import getUtilitiesFor
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-
-from pyams_utils.request import check_request
__docformat__ = 'restructuredtext'
+from persistent import Persistent
+from zope.component import getUtilitiesFor
+from zope.interface import implementer
+from zope.schema.fieldproperty import FieldProperty
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-# import standard library
-
-# import interfaces
+from pyams_content import _
+from pyams_content.component.video import external_video_settings_factory
from pyams_content.component.video.interfaces import IExternalVideo, IExternalVideoProvider, IExternalVideoSettings
from pyams_content.component.video.provider.interfaces import ICustomVideoSettings
+from pyams_content.features.checker import BaseContentChecker
from pyams_content.features.checker.interfaces import IContentChecker
-
-# import packages
-from persistent import Persistent
-from pyams_content.component.video import external_video_settings_factory
-from pyams_content.features.checker import BaseContentChecker
from pyams_utils.adapter import adapter_config
from pyams_utils.registry import utility_config
+from pyams_utils.request import check_request
from pyams_utils.vocabulary import vocabulary_config
-from zope.interface import implementer
-from zope.schema.fieldproperty import FieldProperty
-
-from pyams_content import _
@vocabulary_config(name='PyAMS video providers')
--- a/src/pyams_content/features/renderer/skin/__init__.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/features/renderer/skin/__init__.py Thu Sep 20 10:48:36 2018 +0200
@@ -12,22 +12,16 @@
__docformat__ = 'restructuredtext'
+from pyramid.decorator import reify
+from zope.interface import implementer
-# import standard library
-
-# import interfaces
+from pyams_content import _
from pyams_content.features.renderer.interfaces import IContentRenderer, IRendererSettings, IRenderedContent, \
HIDDEN_RENDERER_NAME
from pyams_i18n.interfaces import II18n
from pyams_skin.layer import IPyAMSLayer
-
-# import packages
from pyams_template.template import get_view_template
from pyams_utils.adapter import ContextRequestAdapter, adapter_config
-from pyramid.decorator import reify
-from zope.interface import implementer
-
-from pyams_content import _
@implementer(IContentRenderer)
@@ -71,5 +65,6 @@
label = _("Hidden content")
weight = -999
+ @staticmethod
def render(self):
return ''
--- a/src/pyams_content/features/review/zmi/__init__.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/features/review/zmi/__init__.py Thu Sep 20 10:48:36 2018 +0200
@@ -12,27 +12,25 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
+from pyramid.view import view_config
+from pyramid_chameleon.interfaces import IChameleonTranslate
+from z3c.form import field, button
+from zope.interface import Interface
+from zope.schema import Text, Bool
-# import interfaces
+from pyams_content import _
+from pyams_content.features.review import ReviewComment
+from pyams_content.features.review.interfaces import IReviewManager, IReviewComments, IReviewTarget
from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION, COMMENT_CONTENT_PERMISSION
-from pyams_content.features.review.interfaces import IReviewManager, IReviewComments, IReviewTarget
from pyams_content.shared.common import IWfSharedContentRoles
-from pyams_security.interfaces import ISecurityManager
-from pyams_security.interfaces.profile import IPublicProfile
-from pyams_skin.interfaces.viewlet import IContextActions
-from pyams_skin.layer import IPyAMSLayer
-from pyams_zmi.interfaces.menu import IContentManagementMenu
-from pyams_zmi.layer import IAdminLayer
-from pyramid_chameleon.interfaces import IChameleonTranslate
-
-# import packages
-from pyams_content.features.review import ReviewComment
from pyams_form.form import AJAXAddForm, ajax_config
from pyams_form.schema import CloseButton
from pyams_pagelet.pagelet import pagelet_config
+from pyams_security.interfaces import ISecurityManager
+from pyams_security.interfaces.profile import IPublicProfile
from pyams_security.schema import PrincipalsSet
+from pyams_skin.interfaces.viewlet import IContextActions
+from pyams_skin.layer import IPyAMSLayer
from pyams_skin.viewlet.menu import MenuItem
from pyams_skin.viewlet.toolbar import ToolbarMenuItem
from pyams_template.template import template_config, get_view_template
@@ -40,13 +38,9 @@
from pyams_utils.registry import get_utility, query_utility
from pyams_viewlet.viewlet import viewlet_config
from pyams_zmi.form import AdminDialogAddForm
+from pyams_zmi.interfaces.menu import IContentManagementMenu
+from pyams_zmi.layer import IAdminLayer
from pyams_zmi.view import InnerAdminView
-from pyramid.view import view_config
-from z3c.form import field, button
-from zope.interface import Interface
-from zope.schema import Text, Bool
-
-from pyams_content import _
#
@@ -195,13 +189,16 @@
def get_principal(self, principal_id):
return self.security.get_principal(principal_id)
- def get_avatar(self, principal):
+ @staticmethod
+ def get_avatar(principal):
return IPublicProfile(principal).avatar
- def get_date(self, comment):
+ @staticmethod
+ def get_date(comment):
return format_datetime(comment.creation_date)
- def get_age(self, comment):
+ @staticmethod
+ def get_age(comment):
return get_age(comment.creation_date)
--- a/src/pyams_content/profile/admin.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/profile/admin.py Thu Sep 20 10:48:36 2018 +0200
@@ -12,22 +12,17 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
-
-# import interfaces
-from pyams_content.profile.interfaces import IAdminProfile, ADMIN_PROFILE_KEY
-from pyams_security.interfaces import IPrincipalInfo
-from pyams_utils.interfaces import PUBLIC_PERMISSION
-
-# import packages
from persistent import Persistent
-from pyams_utils.adapter import adapter_config, get_annotation_adapter
-from pyams_utils.request import check_request, query_request
from pyramid.security import Allow, ALL_PERMISSIONS, Everyone
from zope.interface import implementer, Interface
from zope.schema.fieldproperty import FieldProperty
+from pyams_content.profile.interfaces import IAdminProfile, ADMIN_PROFILE_KEY
+from pyams_security.interfaces import IPrincipalInfo
+from pyams_utils.adapter import adapter_config, get_annotation_adapter
+from pyams_utils.interfaces import PUBLIC_PERMISSION
+from pyams_utils.request import check_request, query_request
+
@implementer(IAdminProfile)
class AdminProfile(Persistent):
@@ -36,7 +31,8 @@
favorites = FieldProperty(IAdminProfile['favorites'])
table_page_length = FieldProperty(IAdminProfile['table_page_length'])
- def __acl__(self):
+ @staticmethod
+ def __acl__():
result = [(Allow, 'system:admin', ALL_PERMISSIONS)]
request = query_request()
if request is not None:
--- a/src/pyams_content/shared/blog/zmi/__init__.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/shared/blog/zmi/__init__.py Thu Sep 20 10:48:36 2018 +0200
@@ -16,20 +16,23 @@
# import standard library
from datetime import datetime
+from pyramid.decorator import reify
+from pyramid.path import DottedNameResolver
+from pyramid.view import view_config
+from zope.interface import Interface
+from zope.lifecycleevent import ObjectCreatedEvent
+
+from pyams_content import _
# import interfaces
from pyams_content.interfaces import CREATE_CONTENT_PERMISSION
from pyams_content.shared.blog.interfaces import IWfBlogPost, IBlogManager
+# import packages
+from pyams_content.shared.common.zmi import SharedContentAddForm, SharedContentAJAXAddForm
from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.interfaces import IContentTitle
from pyams_skin.interfaces.viewlet import IMenuHeader, IWidgetTitleViewletManager
from pyams_skin.layer import IPyAMSLayer
-from pyams_workflow.interfaces import IWorkflowVersions, IWorkflowInfo
-from pyams_zmi.interfaces.menu import IContentManagementMenu
-from pyams_zmi.layer import IAdminLayer
-
-# import packages
-from pyams_content.shared.common.zmi import SharedContentAddForm, SharedContentAJAXAddForm
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_skin.interfaces import IContentTitle
from pyams_skin.viewlet.toolbar import ToolbarAction
from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter, ContextRequestAdapter
from pyams_utils.registry import get_utility
@@ -37,13 +40,9 @@
from pyams_utils.unicode import translate_string
from pyams_utils.url import absolute_url, generate_url
from pyams_viewlet.viewlet import viewlet_config
-from pyramid.decorator import reify
-from pyramid.path import DottedNameResolver
-from pyramid.view import view_config
-from zope.interface import Interface
-from zope.lifecycleevent import ObjectCreatedEvent
-
-from pyams_content import _
+from pyams_workflow.interfaces import IWorkflowVersions, IWorkflowInfo
+from pyams_zmi.interfaces.menu import IContentManagementMenu
+from pyams_zmi.layer import IAdminLayer
@adapter_config(context=(IWfBlogPost, IContentManagementMenu), provides=IMenuHeader)
@@ -82,6 +81,8 @@
legend = _("Add blog post")
content_url = None
+ __target = None
+
@reify
def content_factory(self):
registry = self.request.registry
--- a/src/pyams_content/shared/common/zmi/__init__.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/__init__.py Thu Sep 20 10:48:36 2018 +0200
@@ -17,52 +17,51 @@
from datetime import datetime
from uuid import uuid4
+from pyramid.location import lineage
+from z3c.form import field, button
+from zope.copy import copy
+from zope.dublincore.interfaces import IZopeDublinCore
+from zope.interface import Interface
+from zope.lifecycleevent import ObjectCreatedEvent
+from zope.location import locate
+
+from pyams_content import _
+from pyams_content.features.review.interfaces import IReviewComments
# import interfaces
from pyams_content.interfaces import MANAGE_SITE_ROOT_PERMISSION, MANAGE_CONTENT_PERMISSION, \
CREATE_CONTENT_PERMISSION, PUBLISH_CONTENT_PERMISSION
-from pyams_content.features.review.interfaces import IReviewComments
from pyams_content.shared.common.interfaces import IWfSharedContent, ISharedContent, IBaseSharedTool, \
IManagerRestrictions
+# import packages
+from pyams_form.form import AJAXAddForm, ajax_config
from pyams_form.interfaces.form import IFormContextPermissionChecker, IWidgetsPrefixViewletsManager
+from pyams_form.schema import CloseButton
from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
+from pyams_i18n.widget import I18nSEOTextLineFieldWidget
+from pyams_pagelet.pagelet import pagelet_config
from pyams_sequence.interfaces import ISequentialIdInfo
from pyams_skin.interfaces import IContentTitle
from pyams_skin.interfaces.container import ITable, ITableElementEditor
from pyams_skin.interfaces.viewlet import IContextActions, IMenuHeader, IBreadcrumbItem
from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import FORBIDDEN_PERMISSION
-from pyams_workflow.interfaces import IWorkflowVersions, IWorkflowInfo, IWorkflowState, IWorkflowCommentInfo, \
- IWorkflow, IWorkflowPublicationInfo
-from pyams_zmi.interfaces.menu import ISiteManagementMenu
-from pyams_zmi.layer import IAdminLayer
-from zope.dublincore.interfaces import IZopeDublinCore
-
-# import packages
-from pyams_form.form import AJAXAddForm, ajax_config
-from pyams_form.schema import CloseButton
-from pyams_i18n.widget import I18nSEOTextLineFieldWidget
-from pyams_pagelet.pagelet import pagelet_config
from pyams_skin.page import DefaultPageHeaderAdapter
from pyams_skin.table import DefaultElementEditorAdapter
from pyams_skin.viewlet.breadcrumb import BreadcrumbAdminLayerItem
from pyams_skin.viewlet.toolbar import ToolbarMenuItem, ToolbarMenuDivider
from pyams_template.template import template_config
from pyams_utils.adapter import adapter_config, ContextRequestViewAdapter, ContextAdapter, ContextRequestAdapter
+from pyams_utils.interfaces import FORBIDDEN_PERMISSION
from pyams_utils.registry import get_utility
from pyams_utils.request import check_request
from pyams_utils.traversing import get_parent
from pyams_utils.url import absolute_url, generate_url
from pyams_viewlet.viewlet import viewlet_config, Viewlet
+from pyams_workflow.interfaces import IWorkflowVersions, IWorkflowInfo, IWorkflowState, IWorkflowCommentInfo, \
+ IWorkflow, IWorkflowPublicationInfo
from pyams_workflow.versions import WorkflowHistoryItem
from pyams_zmi.form import AdminDialogAddForm
-from pyramid.location import lineage
-from z3c.form import field, button
-from zope.copy import copy
-from zope.interface import Interface
-from zope.lifecycleevent import ObjectCreatedEvent
-from zope.location import locate
-
-from pyams_content import _
+from pyams_zmi.interfaces.menu import ISiteManagementMenu
+from pyams_zmi.layer import IAdminLayer
class SharedContentAddForm(AdminDialogAddForm):
@@ -79,6 +78,8 @@
ajax_handler = 'add-shared-content.json'
edit_permission = CREATE_CONTENT_PERMISSION
+ __uuid = None
+
def updateWidgets(self, prefix=None):
super(SharedContentAddForm, self).updateWidgets(prefix)
if 'title' in self.widgets:
--- a/src/pyams_content/shared/common/zmi/dashboard.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/dashboard.py Thu Sep 20 10:48:36 2018 +0200
@@ -22,6 +22,7 @@
from zope.intid.interfaces import IIntIds
from pyams_catalog.query import CatalogResultSet
+from pyams_content import _
from pyams_content.interfaces import MANAGE_SITE_ROOT_PERMISSION, PUBLISH_CONTENT_PERMISSION
from pyams_content.profile.interfaces import IAdminProfile
from pyams_content.shared.common import CONTENT_TYPES
@@ -58,8 +59,6 @@
from pyams_zmi.layer import IAdminLayer
from pyams_zmi.view import InnerAdminView
-from pyams_content import _
-
#
# Shared tools common adapters
@@ -335,8 +334,8 @@
catalog = get_utility(ICatalog)
workflow = get_utility(IWorkflow, name=self.context.shared_content_workflow)
params = Eq(catalog['parents'], intids.register(self.context)) & \
- Any(catalog['content_type'], CONTENT_TYPES.keys()) & \
- Any(catalog['workflow_state'], workflow.waiting_states)
+ Any(catalog['content_type'], CONTENT_TYPES.keys()) & \
+ Any(catalog['workflow_state'], workflow.waiting_states)
yield from filter(self.check_access,
unique_iter(map(lambda x: sorted(IWorkflowVersions(x).get_versions(IWorkflowState(x).state),
key=lambda y: IZopeDublinCore(y).modified, reverse=True)[0],
@@ -379,9 +378,9 @@
catalog = get_utility(ICatalog)
workflow = get_utility(IWorkflow, name=self.context.shared_content_workflow)
params = Eq(catalog['parents'], intids.register(self.context)) & \
- Any(catalog['content_type'], CONTENT_TYPES.keys()) & \
- Any(catalog['workflow_state'], workflow.waiting_states) & \
- Eq(catalog['workflow_principal'], self.request.principal.id)
+ Any(catalog['content_type'], CONTENT_TYPES.keys()) & \
+ Any(catalog['workflow_state'], workflow.waiting_states) & \
+ Eq(catalog['workflow_principal'], self.request.principal.id)
yield from unique_iter(map(lambda x: sorted(IWorkflowVersions(x).get_versions(IWorkflowState(x).state),
key=lambda y: IZopeDublinCore(y).modified, reverse=True)[0],
CatalogResultSet(CatalogQuery(catalog).query(params,
@@ -989,7 +988,7 @@
intids = get_utility(IIntIds)
catalog = get_utility(ICatalog)
params = Eq(catalog['parents'], intids.register(self.context)) & \
- Any(catalog['content_type'], CONTENT_TYPES.keys())
+ Any(catalog['content_type'], CONTENT_TYPES.keys())
yield from unique_iter(CatalogResultSet(CatalogQuery(catalog).query(params,
limit=50,
sort_index='modified_date',
--- a/src/pyams_content/shared/common/zmi/header.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/header.py Thu Sep 20 10:48:36 2018 +0200
@@ -12,10 +12,10 @@
__docformat__ = 'restructuredtext'
+from pyramid.decorator import reify
+from zope.interface import Interface
-# import standard library
-
-# import interfaces
+from pyams_content import _
from pyams_content.profile.interfaces import IAdminProfile
from pyams_content.shared.common.interfaces import IWfSharedContent, IBaseSharedTool
from pyams_form.interfaces.form import IInnerTabForm
@@ -24,10 +24,6 @@
from pyams_sequence.interfaces import ISequentialIntIds, ISequentialIdInfo
from pyams_skin.interfaces import IContextTitlePrefix
from pyams_skin.layer import IPyAMSLayer
-from pyams_workflow.interfaces import IWorkflowState, IWorkflow, IWorkflowStateLabel, IWorkflowVersions, \
- IWorkflowPublicationInfo
-
-# import packages
from pyams_skin.site import ContextTitlePrefixAdapter
from pyams_template.template import template_config
from pyams_utils.adapter import adapter_config
@@ -36,10 +32,8 @@
from pyams_utils.traversing import get_parent
from pyams_utils.url import absolute_url
from pyams_viewlet.viewlet import contentprovider_config
-from pyramid.decorator import reify
-from zope.interface import Interface
-
-from pyams_content import _
+from pyams_workflow.interfaces import IWorkflowState, IWorkflow, IWorkflowStateLabel, IWorkflowVersions, \
+ IWorkflowPublicationInfo
@adapter_config(context=(IWfSharedContent, IPyAMSLayer), provides=IContextTitlePrefix)
@@ -192,5 +186,6 @@
def update(self):
pass
- def render(self):
+ @staticmethod
+ def render():
return ''
--- a/src/pyams_content/shared/common/zmi/workflow.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/shared/common/zmi/workflow.py Thu Sep 20 10:48:36 2018 +0200
@@ -715,6 +715,8 @@
buttons = button.Buttons(ISharedContentDeleteButtons)
+ __target = None
+
@property
def fields(self):
fields = super(SharedContentDeleteForm, self).fields
--- a/src/pyams_content/shared/site/link.py Wed Sep 19 17:22:56 2018 +0200
+++ b/src/pyams_content/shared/site/link.py Thu Sep 20 10:48:36 2018 +0200
@@ -12,26 +12,20 @@
__docformat__ = 'restructuredtext'
-
-# import standard library
-
-# import interfaces
-from pyams_content.shared.site.interfaces import IContentLink
-from pyams_utils.interfaces.url import IRelativeURL
-from pyams_workflow.interfaces import IWorkflow, IWorkflowVersion, IWorkflowVersions, IWorkflowPublicationInfo, \
- IWorkflowState
-
-# import packages
from persistent import Persistent
-from pyams_sequence.reference import get_reference_target
-from pyams_skin.layer import IPyAMSUserLayer
-from pyams_utils.adapter import adapter_config
-from pyams_utils.zodb import volatile_property
from zope.container.contained import Contained
from zope.interface import implementer
from zope.schema.fieldproperty import FieldProperty
from pyams_content import _
+from pyams_content.shared.site.interfaces import IContentLink
+from pyams_sequence.reference import get_reference_target
+from pyams_skin.layer import IPyAMSUserLayer
+from pyams_utils.adapter import adapter_config
+from pyams_utils.interfaces.url import IRelativeURL
+from pyams_utils.zodb import volatile_property
+from pyams_workflow.interfaces import IWorkflow, IWorkflowVersion, IWorkflowVersions, IWorkflowPublicationInfo, \
+ IWorkflowState
@implementer(IContentLink)
@@ -48,7 +42,8 @@
content_name = _("Content link")
- def is_deletable(self):
+ @staticmethod
+ def is_deletable():
return True
@volatile_property