Skip to content

Commit

Permalink
Format for easier readability.
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Apr 6, 2016
1 parent a41da74 commit 115c8db
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 28 deletions.
67 changes: 49 additions & 18 deletions plone/app/content/browser/contents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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(
Expand Down
52 changes: 42 additions & 10 deletions plone/app/content/browser/vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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',
]


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 115c8db

Please sign in to comment.