Move portal_properties settings to configuration registry

commit b13db31e3c55fd5ed9320e9d0c93aea48366c883
Author: esteele <eric@esteele.net>
Date:   Fri Sep 18 10:14:56 2015 +0200

    Remove pdb.

commit 6b3e591583146ca661556ef50cafd02f62c79d46
Author: esteele <eric@esteele.net>
Date:   Fri Sep 18 09:50:06 2015 +0200

    Fix registry id

commit 9dfce9a739496b6023f93376535dccc9a9310517
Author: esteele <eric@esteele.net>
Date:   Thu Sep 17 18:34:42 2015 +0200

    Use registry lookup for types_use_view_action_in_listings
This commit is contained in:
esteele 2015-09-20 17:31:55 +02:00
parent e2bd22e74b
commit 98f1f3d6a4
3 changed files with 10 additions and 3 deletions

View File

@ -4,6 +4,9 @@ Changelog
2.4.8 (unreleased) 2.4.8 (unreleased)
------------------ ------------------
- Use registry lookup for types_use_view_action_in_listings
[esteele]
- Remove discussion.css - Remove discussion.css
[pbauer] [pbauer]

View File

@ -1,11 +1,13 @@
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from Acquisition import aq_inner from Acquisition import aq_inner
from Acquisition import aq_parent from Acquisition import aq_parent
from zope.component import getUtility
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView from Products.Five.browser import BrowserView
from Products.statusmessages.interfaces import IStatusMessage from Products.statusmessages.interfaces import IStatusMessage
from comments import CommentForm from comments import CommentForm
from plone.app.discussion import PloneAppDiscussionMessageFactory as _ from plone.app.discussion import PloneAppDiscussionMessageFactory as _
from plone.registry.interfaces import IRegistry
from plone.z3cform.layout import wrap_form from plone.z3cform.layout import wrap_form
from z3c.form import button from z3c.form import button
from zope.component import getMultiAdapter from zope.component import getMultiAdapter
@ -30,8 +32,11 @@ class View(BrowserView):
def __call__(self): def __call__(self):
context = aq_inner(self.context) context = aq_inner(self.context)
ptool = getToolByName(context, 'portal_properties')
view_action_types = ptool.site_properties.typesUseViewActionInListings registry = getUtility(IRegistry)
view_action_types = registry.get(
'plone.types_use_view_action_in_listings', [])
obj = aq_parent(aq_parent(context)) obj = aq_parent(aq_parent(context))
url = obj.absolute_url() url = obj.absolute_url()

View File

@ -15,7 +15,6 @@ Create a collection.
>>> from plone.app.discussion.testing import COLLECTION_TYPE >>> from plone.app.discussion.testing import COLLECTION_TYPE
>>> browser.getLink(url='++add++' + COLLECTION_TYPE).click() >>> browser.getLink(url='++add++' + COLLECTION_TYPE).click()
>>> open('/tmp/testbrowser.html', 'w').write(browser.contents) >>> open('/tmp/testbrowser.html', 'w').write(browser.contents)
>>> import pdb; pdb.set_trace()
>>> browser.getControl('form.widgets.IDublinCore.title').value = 'Foo Comment Collection' >>> browser.getControl('form.widgets.IDublinCore.title').value = 'Foo Comment Collection'
>>> browser.getControl('Save').click() >>> browser.getControl('Save').click()
>>> print browser.contents >>> print browser.contents