Skip to content

Commit

Permalink
review fixes, pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
fgrcon committed Apr 14, 2017
1 parent da1748f commit a9f158c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion plone/app/content/browser/contents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def ignored_columns(self):
'effective',
'expires',
'getIcon',
'getMimeIcon',
'getMimeIcon',
'getId',
'getRemoteUrl',
'in_response_to',
Expand Down
30 changes: 15 additions & 15 deletions plone/app/content/browser/vocabulary.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
import os
from AccessControl import getSecurityManager
from Acquisition import aq_base
from logging import getLogger
from plone import api
from plone.app.content.utils import json_dumps
from plone.app.content.utils import json_loads
from plone.app.layout.navigation.interfaces import INavigationRoot
Expand All @@ -11,6 +11,7 @@
from plone.app.widgets.interfaces import IFieldPermissionChecker
from plone.autoform.interfaces import WRITE_PERMISSIONS_KEY
from plone.supermodel.utils import mergedTaggedValueDict
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone import PloneMessageFactory as _
from Products.CMFPlone.utils import safe_unicode
from Products.Five import BrowserView
Expand Down Expand Up @@ -148,7 +149,7 @@ def __call__(self):

try:
vocabulary = self.get_vocabulary()
except VocabLookupException, e:
except VocabLookupException as e:
return json_dumps({'error': e.message})

results_are_brains = False
Expand Down Expand Up @@ -237,22 +238,21 @@ def __call__(self):
_(safe_unicode(val)),
context=self.request
)

else:
item[key] = val
if key == 'getMimeIcon':
item[key] = None
if vocab_item.portal_type =='File':
#get mime type icon url from mimetype registry'
portal_url = api.portal.get().absolute_url()
mtt = api.portal.get_tool(
name='mimetypes_registry')
if vocab_item.getObject().file.contentType:
ctype = mtt.lookup(
vocab_item.getObject().file.contentType)
item[key] = os.path.join(
portal_url,
guess_icon_path(ctype[0]))
# get mime type icon url from mimetype registry'
navroot = self.get_base_path(vocab_item)
contenttype = aq_base(
getattr(vocab_item, 'mime_type', None))
if contenttype:
mtt = getToolByName(
self.context, 'mimetypes_registry')
ctype = mtt.lookup(contenttype)
item[key] = os.path.join(
navroot,
guess_icon_path(ctype[0]))
items.append(item)
else:
for item in results:
Expand Down Expand Up @@ -339,7 +339,7 @@ def get_vocabulary(self):
# generation of vocabularies created for plone.app.widgets,
# which take the (unparsed) query as a parameter of the vocab
# factory rather than as a separate search method.
if type(factory) is FunctionType:
if isinstance(factory, FunctionType):
factory_spec = inspect.getargspec(factory)
else:
factory_spec = inspect.getargspec(factory.__call__)
Expand Down

0 comments on commit a9f158c

Please sign in to comment.