Skip to content

Commit

Permalink
Use registry lookup for types_use_view_action_in_listings
Browse files Browse the repository at this point in the history
  • Loading branch information
esteele committed Sep 17, 2015
1 parent 225f56a commit e628817
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ Changelog
2.1.1 (unreleased)
------------------

- Nothing changed yet.
- Use registry lookup for types_use_view_action_in_listings
[esteele]


2.1.0 (2015-09-07)
------------------

- Pull lock_on_ttw_edit setting from
- Pull lock_on_ttw_edit setting from the configuration registry
[esteele]


2.0.8 (2015-07-20)
Expand Down
12 changes: 7 additions & 5 deletions plone/locking/browser/locking.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

from Acquisition import aq_inner
from zope.component import getUtility
from Products.Five import BrowserView
from Products.CMFCore.utils import getToolByName

from DateTime import DateTime
from datetime import timedelta

from plone.locking.interfaces import ILockable, IRefreshableLockable
from plone.registry.interfaces import IRegistry
from zope.i18nmessageid import MessageFactory

_ = MessageFactory('plone')
Expand All @@ -26,11 +28,11 @@ def force_unlock(self, redirect=True):
lockable.unlock()
if redirect:
url = self.context.absolute_url()
props_tool = getToolByName(self.context, 'portal_properties')
if props_tool:
types_use_view = props_tool.site_properties.typesUseViewActionInListings
if self.context.portal_type in types_use_view:
url += '/view'
registry = getUtility(IRegistry)
types_use_view = registry.get(
'plone.types_view_action_in_listings', [])
if self.context.portal_type in types_use_view:
url += '/view'

self.request.RESPONSE.redirect(url)

Expand Down

0 comments on commit e628817

Please sign in to comment.