Skip to content

Commit

Permalink
Allow for easier override of BaseVocabularyView settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Gagaro authored and jensens committed Mar 2, 2017
1 parent 6565502 commit 9c220b2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 41 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Breaking changes:

New features:

- *add item here*
- Allow for easier overriding of some BaseVocabularyView settings
[Gagaro]

Bug fixes:

Expand Down
87 changes: 47 additions & 40 deletions plone/app/content/browser/vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,45 @@
'plone.app.vocabularies.SyndicatableFeedItems': 'Modify portal content',
'plone.app.vocabularies.Users': 'Modify portal content',
}
TRANSLATED_IGNORED = [
'author_name',
'cmf_uid',
'commentators',
'created',
'CreationDate',
'Creator',
'Date',
'Description',
'effective',
'EffectiveDate',
'end',
'exclude_from_nav',
'ExpirationDate',
'expires',
'getIcon',
'getId',
'getObjSize',
'getRemoteUrl',
'getURL',
'id',
'in_response_to',
'is_folderish',
'last_comment_date',
'listCreators',
'location',
'meta_type',
'ModificationDate',
'modified',
'path',
'portal_type',
'review_state',
'start',
'Subject',
'sync_uid',
'Title',
'total_comments'
'UID',
]

_permissions = PERMISSIONS
deprecated('_permissions', 'Use PERMISSIONS variable instead.')
Expand Down Expand Up @@ -74,6 +113,12 @@ class VocabLookupException(Exception):

class BaseVocabularyView(BrowserView):

def get_translated_ignored(self):
return TRANSLATED_IGNORED

def get_base_path(self, context):
return getNavigationRoot(context)

def __call__(self):
"""
Accepts GET parameters of:
Expand Down Expand Up @@ -155,47 +200,9 @@ def __call__(self):
if isinstance(attributes, basestring) and attributes:
attributes = attributes.split(',')

translate_ignored = [
'author_name',
'cmf_uid',
'commentators',
'created',
'CreationDate',
'Creator',
'Date',
'Description',
'effective',
'EffectiveDate',
'end',
'exclude_from_nav',
'ExpirationDate',
'expires',
'getIcon',
'getId',
'getObjSize',
'getRemoteUrl',
'getURL',
'id',
'in_response_to',
'is_folderish',
'last_comment_date',
'listCreators',
'location',
'meta_type',
'ModificationDate',
'modified',
'path',
'portal_type',
'review_state',
'start',
'Subject',
'sync_uid',
'Title',
'total_comments'
'UID',
]
translate_ignored = self.get_translated_ignored()
if attributes:
base_path = getNavigationRoot(context)
base_path = self.get_base_path(context)
sm = getSecurityManager()
can_edit = sm.checkPermission(DEFAULT_PERMISSION_SECURE, context)
for vocab_item in results:
Expand Down

0 comments on commit 9c220b2

Please sign in to comment.