diff --git a/last_commit.txt b/last_commit.txt index ee5e7b1e13..d5dad09762 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,210 +1,484 @@ -Repository: plone.app.discussion +Repository: plone.app.registry Branch: refs/heads/master -Date: 2016-03-11T14:16:22+01:00 +Date: 2016-03-09T16:09:31+01:00 Author: Johannes Raggam (thet) -Commit: https://github.com/plone/plone.app.discussion/commit/ec7fe25b6cc246aad07a3b892ae8b518f6851ef6 +Commit: https://github.com/plone/plone.app.registry/commit/4841a337d38589b54bfc0fa712dea5fcc1763539 -Use ``getSite()`` instead of portal url -For the discussion controlpanel, change base URLs from portal URL to what getSite returns, but don't change the controlpanels context binding. -This allows for more flexibility when configuring it to be allowed on a sub site with a local registry. +Overview control panel url from context +Let the RegistryEditForm construct the base url to the @@overview-controlpanel from the context URL instead the portal URL. +This gives more flexibility when calling controlpanels on contexts with local registries while in standard Plone installations the controlpanel is still bound to the portal url. Files changed: +A plone/app/registry/tests/test_controlpanel.py M CHANGES.rst -M plone/app/discussion/browser/controlpanel.pt -M plone/app/discussion/browser/controlpanel.py +M plone/app/registry/browser/controlpanel.py +M plone/app/registry/browser/controlpanel_layout.pt diff --git a/CHANGES.rst b/CHANGES.rst -index f7cb874..011a53a 100644 +index 2d009b0..bda635c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -6,7 +6,9 @@ Changelog +@@ -10,7 +10,9 @@ Incompatibilities: New: -- *add item here* -+- For the discussion controlpanel, change base URLs from portal URL to what getSite returns, but don't change the controlpanels context binding. -+ This allows for more flexibility when configuring it to be allowed on a sub site with a local registry. ++- Let the ``RegistryEditForm`` construct the base url to the ``@@overview-controlpanel`` from the context URL instead the portal URL. ++ This gives more flexibility when calling controlpanels on contexts with local registries while in standard Plone installations the controlpanel is still bound to the portal url. + [thet] Fixes: -diff --git a/plone/app/discussion/browser/controlpanel.pt b/plone/app/discussion/browser/controlpanel.pt -index b389c24..3486ba2 100644 ---- a/plone/app/discussion/browser/controlpanel.pt -+++ b/plone/app/discussion/browser/controlpanel.pt -@@ -22,7 +22,7 @@ - - Mail control panel - - to fix this. -@@ -42,7 +42,7 @@ - - Types control panel - - to choose a workflow for the 'Discussion Item' type. -@@ -61,7 +61,7 @@ - - migrate your comments - - to fix this. -@@ -73,9 +73,9 @@ - +diff --git a/plone/app/registry/browser/controlpanel.py b/plone/app/registry/browser/controlpanel.py +index dc9b4b1..45f7149 100644 +--- a/plone/app/registry/browser/controlpanel.py ++++ b/plone/app/registry/browser/controlpanel.py +@@ -69,14 +69,20 @@ def handleCancel(self, action): + IStatusMessage(self.request).addStatusMessage( + _(u"Changes canceled."), + "info") +- self.request.response.redirect("%s/%s" % ( ++ self.request.response.redirect(u"{0}/{1}".format( + self.context.absolute_url(), +- self.control_panel_view)) ++ self.control_panel_view ++ )) + + + class ControlPanelFormWrapper(layout.FormWrapper): + """Use this form as the plone.z3cform layout wrapper to get the control + panel layout. + """ +- + index = ViewPageTemplateFile('controlpanel_layout.pt') ++ ++ @property ++ def control_panel_url(self): ++ return u"{0}/@@overview-controlpanel".format( ++ self.context.absolute_url() ++ ) +diff --git a/plone/app/registry/browser/controlpanel_layout.pt b/plone/app/registry/browser/controlpanel_layout.pt +index 9fa9886..1dadb1f 100644 +--- a/plone/app/registry/browser/controlpanel_layout.pt ++++ b/plone/app/registry/browser/controlpanel_layout.pt +@@ -10,7 +10,7 @@ +
-- Site Setup -+ tal:attributes="href string:${view/site_url}/@@overview-controlpanel" -+ i18n:translate=""> -+ Site Setup ++ tal:attributes="href view/control_panel_url" + i18n:translate=""> + Site Setup +diff --git a/plone/app/registry/tests/test_controlpanel.py b/plone/app/registry/tests/test_controlpanel.py +new file mode 100644 +index 0000000..6026c9c +--- /dev/null ++++ b/plone/app/registry/tests/test_controlpanel.py +@@ -0,0 +1,27 @@ ++# -*- coding: utf-8 -*- ++from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper ++from plone.app.registry.testing import PLONE_APP_REGISTRY_INTEGRATION_TESTING ++ ++import types ++import unittest2 as unittest ++ ++ ++class TestRegistryBaseControlpanel(unittest.TestCase): ++ ++ layer = PLONE_APP_REGISTRY_INTEGRATION_TESTING ++ ++ def test_registry_base_controlpanel__control_panel_url(self): ++ """Test, if control_panel_url property of the base controlpanel returns ++ the correct url. ++ """ ++ # Mock context ++ context = type('Dummy', (object,), {}) ++ context.absolute_url = types.MethodType( ++ lambda self: 'http://nohost/noportal/nocontext', ++ context ++ ) ++ view = ControlPanelFormWrapper(context, None) ++ self.assertEqual( ++ view.control_panel_url, ++ u'http://nohost/noportal/nocontext/@@overview-controlpanel' ++ ) + + +Repository: plone.app.registry + + +Branch: refs/heads/master +Date: 2016-03-09T17:07:22+01:00 +Author: Johannes Raggam (thet) +Commit: https://github.com/plone/plone.app.registry/commit/8747e4b1650f94418249e6e27fa4c500a3d57a6c + +For the @@configuration_registry, construct the base url to the @@overview-controlpanel from the nearest site. + +Files changed: +M CHANGES.rst +M plone/app/registry/browser/records.pt +M plone/app/registry/browser/records.py +M plone/app/registry/tests/test_controlpanel.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index bda635c..4be0530 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -10,7 +10,8 @@ Incompatibilities: + + New: -

View Title

-@@ -87,7 +87,7 @@ -
+-- Let the ``RegistryEditForm`` construct the base url to the ``@@overview-controlpanel`` from the context URL instead the portal URL. ++- Let the ``ControlPanelFormWrapper`` construct the base url to the ``@@overview-controlpanel`` from the context URL instead the portal URL. ++ For the ``@@configuration_registry``, construct the base url to the ``@@overview-controlpanel`` from the nearest site. + This gives more flexibility when calling controlpanels on contexts with local registries while in standard Plone installations the controlpanel is still bound to the portal url. + [thet] - +diff --git a/plone/app/registry/browser/records.pt b/plone/app/registry/browser/records.pt +index d683ca9..a4c24c3 100644 +--- a/plone/app/registry/browser/records.pt ++++ b/plone/app/registry/browser/records.pt +@@ -19,9 +19,9 @@ + tal:define="records view/records"> - -diff --git a/plone/app/discussion/browser/controlpanel.py b/plone/app/discussion/browser/controlpanel.py -index 4f19619..b21a6dc 100644 ---- a/plone/app/discussion/browser/controlpanel.py -+++ b/plone/app/discussion/browser/controlpanel.py -@@ -104,6 +104,13 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): - form = DiscussionSettingsEditForm - index = ViewPageTemplateFile('controlpanel.pt') + +- Site Setup ++ Site Setup + + +

Configuration Registry

+diff --git a/plone/app/registry/browser/records.py b/plone/app/registry/browser/records.py +index feb8017..f817de9 100644 +--- a/plone/app/registry/browser/records.py ++++ b/plone/app/registry/browser/records.py +@@ -1,6 +1,7 @@ + # -*- coding: utf-8 -*- + from Products.CMFPlone.PloneBatch import Batch + from Products.Five import BrowserView ++from zope.component.hooks import getSite + + + def _true(s, v): +@@ -23,6 +24,12 @@ def _starts_with(s, v): + + class RecordsControlPanel(BrowserView): + @property -+ def site_url(self): -+ """Return the absolute URL to the current site, which is likely not -+ necessarily the portal root. ++ def control_panel_url(self): ++ return u"{0}/@@overview-controlpanel".format( ++ getSite().absolute_url() ++ ) ++ + def __call__(self): + form = self.request.form + search = form.get('q') +diff --git a/plone/app/registry/tests/test_controlpanel.py b/plone/app/registry/tests/test_controlpanel.py +index 6026c9c..f84823e 100644 +--- a/plone/app/registry/tests/test_controlpanel.py ++++ b/plone/app/registry/tests/test_controlpanel.py +@@ -1,5 +1,6 @@ + # -*- coding: utf-8 -*- + from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper ++from plone.app.registry.browser.records import RecordsControlPanel + from plone.app.registry.testing import PLONE_APP_REGISTRY_INTEGRATION_TESTING + + import types +@@ -25,3 +26,18 @@ def test_registry_base_controlpanel__control_panel_url(self): + view.control_panel_url, + u'http://nohost/noportal/nocontext/@@overview-controlpanel' + ) ++ ++ ++class TestRecordsControlPanel(unittest.TestCase): ++ ++ layer = PLONE_APP_REGISTRY_INTEGRATION_TESTING ++ ++ def test_records_control_panel__control_panel_url(self): ++ """Test, if control_panel_url property of the registry controlpanel ++ returns the correct url. + """ -+ return getSite().absolute_url() ++ view = RecordsControlPanel(None, None) ++ self.assertEqual( ++ view.control_panel_url, ++ u'http://nohost/plone/@@overview-controlpanel' ++ ) + + +Repository: plone.app.registry + + +Branch: refs/heads/master +Date: 2016-03-11T12:51:49+01:00 +Author: Johannes Raggam (thet) +Commit: https://github.com/plone/plone.app.registry/commit/de6c4c65bc4649be8d7191cfe6ed0338c87968ba + +Consistency: For ``ControlPanelFormWrapper`` and ``@@configuration_registry``, construct the base url to the ``@@overview-controlpanel`` from the nearest site. + +Files changed: +M CHANGES.rst +M plone/app/registry/browser/controlpanel.py +M plone/app/registry/browser/records.py +M plone/app/registry/tests/test_controlpanel.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index 4be0530..5e432f8 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -10,9 +10,8 @@ Incompatibilities: + + New: + +-- Let the ``ControlPanelFormWrapper`` construct the base url to the ``@@overview-controlpanel`` from the context URL instead the portal URL. +- For the ``@@configuration_registry``, construct the base url to the ``@@overview-controlpanel`` from the nearest site. +- This gives more flexibility when calling controlpanels on contexts with local registries while in standard Plone installations the controlpanel is still bound to the portal url. ++- For ``ControlPanelFormWrapper`` and ``@@configuration_registry``, construct the base url to the ``@@overview-controlpanel`` from the nearest site. ++ This gives more flexibility when calling controlpanels on sub sites with local registries while in standard Plone installations the controlpanel is still bound to the portal url. + [thet] + + Fixes: +diff --git a/plone/app/registry/browser/controlpanel.py b/plone/app/registry/browser/controlpanel.py +index 45f7149..fe2eeda 100644 +--- a/plone/app/registry/browser/controlpanel.py ++++ b/plone/app/registry/browser/controlpanel.py +@@ -10,7 +10,9 @@ + from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile + from Products.statusmessages.interfaces import IStatusMessage + ++from zope.component.hooks import getSite + from zope.i18nmessageid import MessageFactory + - def settings(self): - """Compose a string that contains all registry settings that are - needed for the discussion control panel. + _ = MessageFactory('plone') + + +@@ -70,7 +72,7 @@ def handleCancel(self, action): + _(u"Changes canceled."), + "info") + self.request.response.redirect(u"{0}/{1}".format( +- self.context.absolute_url(), ++ getSite().absolute_url(), + self.control_panel_view + )) + +@@ -83,6 +85,4 @@ class ControlPanelFormWrapper(layout.FormWrapper): + + @property + def control_panel_url(self): +- return u"{0}/@@overview-controlpanel".format( +- self.context.absolute_url() +- ) ++ return u"{0}/@@overview-controlpanel".format(getSite().absolute_url()) +diff --git a/plone/app/registry/browser/records.py b/plone/app/registry/browser/records.py +index f817de9..30aa17d 100644 +--- a/plone/app/registry/browser/records.py ++++ b/plone/app/registry/browser/records.py +@@ -26,9 +26,7 @@ class RecordsControlPanel(BrowserView): + + @property + def control_panel_url(self): +- return u"{0}/@@overview-controlpanel".format( +- getSite().absolute_url() +- ) ++ return u"{0}/@@overview-controlpanel".format(getSite().absolute_url()) + + def __call__(self): + form = self.request.form +diff --git a/plone/app/registry/tests/test_controlpanel.py b/plone/app/registry/tests/test_controlpanel.py +index f84823e..f475575 100644 +--- a/plone/app/registry/tests/test_controlpanel.py ++++ b/plone/app/registry/tests/test_controlpanel.py +@@ -15,16 +15,10 @@ def test_registry_base_controlpanel__control_panel_url(self): + """Test, if control_panel_url property of the base controlpanel returns + the correct url. + """ +- # Mock context +- context = type('Dummy', (object,), {}) +- context.absolute_url = types.MethodType( +- lambda self: 'http://nohost/noportal/nocontext', +- context +- ) +- view = ControlPanelFormWrapper(context, None) ++ view = ControlPanelFormWrapper(None, None) + self.assertEqual( + view.control_panel_url, +- u'http://nohost/noportal/nocontext/@@overview-controlpanel' ++ u'http://nohost/plone/@@overview-controlpanel' + ) + + -Repository: plone.app.discussion +Repository: plone.app.registry Branch: refs/heads/master -Date: 2016-03-14T11:06:43+01:00 +Date: 2016-03-14T11:07:06+01:00 Author: Jens W. Klein (jensens) -Commit: https://github.com/plone/plone.app.discussion/commit/12d5347ca82e8f0aee91f1652cadeb80b6552f8a +Commit: https://github.com/plone/plone.app.registry/commit/8ead84792873f99ecc3d6f6a64a072aff93f547b -Merge pull request #87 from plone/thet-control-panel-url +Merge pull request #17 from plone/thet-control-panel-url -Use ``getSite()`` instead of portal url +Overview control panel url from context Files changed: +A plone/app/registry/tests/test_controlpanel.py M CHANGES.rst -M plone/app/discussion/browser/controlpanel.pt -M plone/app/discussion/browser/controlpanel.py +M plone/app/registry/browser/controlpanel.py +M plone/app/registry/browser/controlpanel_layout.pt +M plone/app/registry/browser/records.pt +M plone/app/registry/browser/records.py diff --git a/CHANGES.rst b/CHANGES.rst -index f7cb874..011a53a 100644 +index 2d009b0..5e432f8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -6,7 +6,9 @@ Changelog +@@ -10,7 +10,9 @@ Incompatibilities: New: -- *add item here* -+- For the discussion controlpanel, change base URLs from portal URL to what getSite returns, but don't change the controlpanels context binding. -+ This allows for more flexibility when configuring it to be allowed on a sub site with a local registry. ++- For ``ControlPanelFormWrapper`` and ``@@configuration_registry``, construct the base url to the ``@@overview-controlpanel`` from the nearest site. ++ This gives more flexibility when calling controlpanels on sub sites with local registries while in standard Plone installations the controlpanel is still bound to the portal url. + [thet] Fixes: -diff --git a/plone/app/discussion/browser/controlpanel.pt b/plone/app/discussion/browser/controlpanel.pt -index b389c24..3486ba2 100644 ---- a/plone/app/discussion/browser/controlpanel.pt -+++ b/plone/app/discussion/browser/controlpanel.pt -@@ -22,7 +22,7 @@ - - Mail control panel - - to fix this. -@@ -42,7 +42,7 @@ - - Types control panel - - to choose a workflow for the 'Discussion Item' type. -@@ -61,7 +61,7 @@ - - migrate your comments - - to fix this. -@@ -73,9 +73,9 @@ - +diff --git a/plone/app/registry/browser/controlpanel.py b/plone/app/registry/browser/controlpanel.py +index dc9b4b1..fe2eeda 100644 +--- a/plone/app/registry/browser/controlpanel.py ++++ b/plone/app/registry/browser/controlpanel.py +@@ -10,7 +10,9 @@ + from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile + from Products.statusmessages.interfaces import IStatusMessage + ++from zope.component.hooks import getSite + from zope.i18nmessageid import MessageFactory ++ + _ = MessageFactory('plone') + + +@@ -69,14 +71,18 @@ def handleCancel(self, action): + IStatusMessage(self.request).addStatusMessage( + _(u"Changes canceled."), + "info") +- self.request.response.redirect("%s/%s" % ( +- self.context.absolute_url(), +- self.control_panel_view)) ++ self.request.response.redirect(u"{0}/{1}".format( ++ getSite().absolute_url(), ++ self.control_panel_view ++ )) + + + class ControlPanelFormWrapper(layout.FormWrapper): + """Use this form as the plone.z3cform layout wrapper to get the control + panel layout. + """ +- + index = ViewPageTemplateFile('controlpanel_layout.pt') ++ ++ @property ++ def control_panel_url(self): ++ return u"{0}/@@overview-controlpanel".format(getSite().absolute_url()) +diff --git a/plone/app/registry/browser/controlpanel_layout.pt b/plone/app/registry/browser/controlpanel_layout.pt +index 9fa9886..1dadb1f 100644 +--- a/plone/app/registry/browser/controlpanel_layout.pt ++++ b/plone/app/registry/browser/controlpanel_layout.pt +@@ -10,7 +10,7 @@ +
+ + + Site Setup + +diff --git a/plone/app/registry/browser/records.pt b/plone/app/registry/browser/records.pt +index d683ca9..a4c24c3 100644 +--- a/plone/app/registry/browser/records.pt ++++ b/plone/app/registry/browser/records.pt +@@ -19,9 +19,9 @@ + tal:define="records view/records"> -- Site Setup -+ tal:attributes="href string:${view/site_url}/@@overview-controlpanel" -+ i18n:translate=""> -+ Site Setup ++ tal:attributes="href view/control_panel_url" + i18n:translate=""> +- Site Setup ++ Site Setup -

View Title

-@@ -87,7 +87,7 @@ -
+

Configuration Registry

+diff --git a/plone/app/registry/browser/records.py b/plone/app/registry/browser/records.py +index feb8017..30aa17d 100644 +--- a/plone/app/registry/browser/records.py ++++ b/plone/app/registry/browser/records.py +@@ -1,6 +1,7 @@ + # -*- coding: utf-8 -*- + from Products.CMFPlone.PloneBatch import Batch + from Products.Five import BrowserView ++from zope.component.hooks import getSite - - -diff --git a/plone/app/discussion/browser/controlpanel.py b/plone/app/discussion/browser/controlpanel.py -index 4f19619..b21a6dc 100644 ---- a/plone/app/discussion/browser/controlpanel.py -+++ b/plone/app/discussion/browser/controlpanel.py -@@ -104,6 +104,13 @@ class DiscussionSettingsControlPanel(controlpanel.ControlPanelFormWrapper): - form = DiscussionSettingsEditForm - index = ViewPageTemplateFile('controlpanel.pt') + def _true(s, v): +@@ -23,6 +24,10 @@ def _starts_with(s, v): + + class RecordsControlPanel(BrowserView): + @property -+ def site_url(self): -+ """Return the absolute URL to the current site, which is likely not -+ necessarily the portal root. ++ def control_panel_url(self): ++ return u"{0}/@@overview-controlpanel".format(getSite().absolute_url()) ++ + def __call__(self): + form = self.request.form + search = form.get('q') +diff --git a/plone/app/registry/tests/test_controlpanel.py b/plone/app/registry/tests/test_controlpanel.py +new file mode 100644 +index 0000000..f475575 +--- /dev/null ++++ b/plone/app/registry/tests/test_controlpanel.py +@@ -0,0 +1,37 @@ ++# -*- coding: utf-8 -*- ++from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper ++from plone.app.registry.browser.records import RecordsControlPanel ++from plone.app.registry.testing import PLONE_APP_REGISTRY_INTEGRATION_TESTING ++ ++import types ++import unittest2 as unittest ++ ++ ++class TestRegistryBaseControlpanel(unittest.TestCase): ++ ++ layer = PLONE_APP_REGISTRY_INTEGRATION_TESTING ++ ++ def test_registry_base_controlpanel__control_panel_url(self): ++ """Test, if control_panel_url property of the base controlpanel returns ++ the correct url. + """ -+ return getSite().absolute_url() ++ view = ControlPanelFormWrapper(None, None) ++ self.assertEqual( ++ view.control_panel_url, ++ u'http://nohost/plone/@@overview-controlpanel' ++ ) ++ ++ ++class TestRecordsControlPanel(unittest.TestCase): + - def settings(self): - """Compose a string that contains all registry settings that are - needed for the discussion control panel. ++ layer = PLONE_APP_REGISTRY_INTEGRATION_TESTING ++ ++ def test_records_control_panel__control_panel_url(self): ++ """Test, if control_panel_url property of the registry controlpanel ++ returns the correct url. ++ """ ++ view = RecordsControlPanel(None, None) ++ self.assertEqual( ++ view.control_panel_url, ++ u'http://nohost/plone/@@overview-controlpanel' ++ )