From 115c8dbf6474c9cc70de556a51d8bb9737f42884 Mon Sep 17 00:00:00 2001 From: Johannes Raggam <thetetet@gmail.com> Date: Fri, 25 Mar 2016 10:50:15 +0100 Subject: [PATCH] Format for easier readability. --- .../app/content/browser/contents/__init__.py | 67 ++++++++++++++----- plone/app/content/browser/vocabulary.py | 52 +++++++++++--- 2 files changed, 91 insertions(+), 28 deletions(-) diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py index 7d63e09f..5199106b 100644 --- a/plone/app/content/browser/contents/__init__.py +++ b/plone/app/content/browser/contents/__init__.py @@ -172,26 +172,43 @@ def get_actions(self): def get_columns(self): # Base set of columns columns = { - 'id': translate(_('ID'), context=self.request), - 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa - 'EffectiveDate': translate(_('Publication date'), context=self.request), # noqa - 'ExpirationDate': translate(_('Expiration date'), context=self.request), #noqa 'CreationDate': translate(_('Created on'), context=self.request), # noqa - 'review_state': translate(_('Review state'), context=self.request), # noqa - 'Subject': translate(_('Tags'), context=self.request), - 'portal_type': translate(_('Type'), context=self.request), - 'is_folderish': translate(_('Folder'), context=self.request), + 'EffectiveDate': translate(_('Publication date'), context=self.request), # noqa 'exclude_from_nav': translate(_('Excluded from navigation'), context=self.request), # noqa + 'ExpirationDate': translate(_('Expiration date'), context=self.request), # noqa 'getObjSize': translate(_('Object Size'), context=self.request), # noqa + 'id': translate(_('ID'), context=self.request), + 'is_folderish': translate(_('Folder'), context=self.request), 'last_comment_date': translate(_('Last comment date'), context=self.request), # noqa + 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa + 'portal_type': translate(_('Type'), context=self.request), + 'review_state': translate(_('Review state'), context=self.request), # noqa + 'Subject': translate(_('Tags'), context=self.request), 'total_comments': translate(_('Total comments'), context=self.request), # noqa } # These columns either have alternatives or are probably not useful ignored = [ - 'Creator', 'Date', 'Description', 'Title', 'Type', 'author_name', - 'cmf_uid', 'commentators', 'created', 'effective', 'end', - 'expires', 'getIcon', 'getId', 'getRemoteUrl', 'in_response_to', - 'listCreators', 'location', 'meta_type', 'modified', 'start', + 'Creator', + 'Date', + 'Description', + 'Title', + 'Type', + 'author_name', + 'cmf_uid', + 'commentators', + 'created', + 'effective', + 'end', + 'expires', + 'getIcon', + 'getId', + 'getRemoteUrl', + 'in_response_to', + 'listCreators', + 'location', + 'meta_type', + 'modified', + 'start', 'sync_uid' ] # Add in extra metadata columns @@ -221,7 +238,7 @@ def get_options(self): 'contextInfoUrl': '%s{path}/@@fc-contextInfo' % base_url, 'setDefaultPageUrl': '%s{path}/@@fc-setDefaultPage' % base_url, 'availableColumns': columns, - 'attributes': ['Title', 'path', 'getURL', 'getIcon'] + columns.keys(), + 'attributes': ['Title', 'path', 'getURL', 'getIcon'] + columns.keys(), # noqa 'buttons': self.get_actions(), 'rearrange': { 'properties': { @@ -251,11 +268,25 @@ def __call__(self): class ContextInfo(BrowserView): - attributes = ['UID', 'Title', 'Type', 'path', 'review_state', - 'ModificationDate', 'EffectiveDate', 'CreationDate', - 'is_folderish', 'Subject', 'getURL', 'id', - 'exclude_from_nav', 'getObjSize', 'last_comment_date', - 'total_comments', 'portal_type'] + attributes = [ + 'CreationDate', + 'EffectiveDate', + 'exclude_from_nav', + 'getObjSize', + 'getURL', + 'id', + 'is_folderish', + 'last_comment_date', + 'ModificationDate', + 'path', + 'portal_type', + 'review_state', + 'Subject', + 'Title', + 'total_comments', + 'Type', + 'UID' + ] def __call__(self): factories_menu = getUtility( diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py index 9f70bacf..85f510b7 100644 --- a/plone/app/content/browser/vocabulary.py +++ b/plone/app/content/browser/vocabulary.py @@ -32,10 +32,10 @@ DEFAULT_PERMISSION = 'View' PERMISSIONS = { - 'plone.app.vocabularies.Users': 'Modify portal content', 'plone.app.vocabularies.Catalog': 'View', 'plone.app.vocabularies.Keywords': 'Modify portal content', - 'plone.app.vocabularies.SyndicatableFeedItems': 'Modify portal content' + 'plone.app.vocabularies.SyndicatableFeedItems': 'Modify portal content', + 'plone.app.vocabularies.Users': 'Modify portal content', } _permissions = deprecated(PERMISSIONS, 'Use PERMISSION variable instead') @@ -51,9 +51,18 @@ def _parseJSON(s): return s -_unsafe_metadata = ['Creator', 'listCreators', 'author_name', 'commentors'] +_unsafe_metadata = [ + 'author_name', + 'commentors', + 'Creator', + 'listCreators', +] _safe_callable_metadata = [ - 'getURL', 'getPath', 'review_state', 'getIcon', 'is_folderish', + 'getIcon', + 'getPath', + 'getURL', + 'is_folderish', + 'review_state', ] @@ -143,12 +152,35 @@ def __call__(self): attributes = attributes.split(',') translate_ignored = [ - 'Creator', 'Date', 'Description', 'Title', 'author_name', - 'cmf_uid', 'commentators', 'created', 'effective', 'end', - 'expires', 'getIcon', 'getId', 'getRemoteUrl', 'in_response_to', - 'listCreators', 'location', 'modified', 'start', 'sync_uid', - 'path', 'getURL', 'EffectiveDate', 'getObjSize', 'id', - 'UID', 'ExpirationDate', 'ModificationDate', 'CreationDate', + 'author_name', + 'cmf_uid', + 'commentators', + 'created', + 'CreationDate', + 'Creator', + 'Date', + 'Description', + 'effective', + 'EffectiveDate', + 'end', + 'ExpirationDate', + 'expires', + 'getIcon', + 'getId', + 'getObjSize', + 'getRemoteUrl', + 'getURL', + 'id', + 'in_response_to', + 'listCreators', + 'location', + 'ModificationDate', + 'modified', + 'path', + 'start', + 'sync_uid', + 'Title', + 'UID', ] if attributes: base_path = getNavigationRoot(context)