Skip to content

Commit

Permalink
Merge pull request #41 from plone/portal-properties-cleanup
Browse files Browse the repository at this point in the history
Portal properties cleanup
  • Loading branch information
pbauer committed Sep 20, 2015
2 parents 3a68b08 + 825042b commit 69cd55d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Changelog
2.3.5 (unreleased)
------------------

- Use registry lookup for types_use_view_action_in_listings
[esteele]

- Don't check type constraints in AddForm.update() if request provides
IDeferSecurityChecks.
[alecm]
Expand Down
23 changes: 8 additions & 15 deletions plone/dexterity/browser/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from plone.dexterity.i18n import MessageFactory as _
from plone.dexterity.interfaces import IDexterityEditForm
from plone.dexterity.interfaces import IDexterityFTI
from plone.registry.interfaces import IRegistry
from plone.z3cform import layout
from z3c.form import button
from z3c.form import form
Expand Down Expand Up @@ -43,21 +44,13 @@ def handleCancel(self, action):

def nextURL(self):
view_url = self.context.absolute_url()
portal_properties = getToolByName(self, 'portal_properties', None)
if portal_properties is not None:
site_properties = getattr(
portal_properties,
'site_properties',
None
)
portal_type = self.portal_type
if site_properties is not None and portal_type is not None:
use_view_action = site_properties.getProperty(
'typesUseViewActionInListings',
()
)
if portal_type in use_view_action:
view_url = view_url + '/view'
portal_type = getattr(self, 'portal_type', None)
if portal_type is not None:
registry = getUtility(IRegistry)
use_view_action = registry.get(
'plone.types_use_view_action_in_listings', [])
if portal_type in use_view_action:
view_url = view_url + '/view'
return view_url

def update(self):
Expand Down

0 comments on commit 69cd55d

Please sign in to comment.