Skip to content

Commit

Permalink
[fc] Repository: plone.app.theming
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2020-09-23T23:58:51+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.theming@88d90a4

Fixed WrongContainedType for hostnameBlackList on Zope 5.

See also plone/plone.app.theming#183.

This reverts commit 9c64d46bf54ebf5259a8ccf400d329991a2cb70a
which was itself a revert of "fix hostnameBlacklist (Theming ControlPanel) in Py3"

In Plone 6 (with Zope 5) this is needed again, because `processInputs` no longer exists.

Files changed:
A news/183.bugfix
M src/plone/app/theming/browser/controlpanel.pt
M src/plone/app/theming/browser/controlpanel.py
Repository: plone.app.theming

Branch: refs/heads/master
Date: 2020-09-24T00:06:17+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.theming@bbed30e

Call safe_nativestring on hostnameBlacklist.

That should work on Py 2 and 3 and Plone 5.2 and 6.0.

Files changed:
M src/plone/app/theming/browser/controlpanel.py
Repository: plone.app.theming

Branch: refs/heads/master
Date: 2020-09-24T00:09:26+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.theming@8a67c21

hostnameBlacklist: PY2 needs no changes.

Files changed:
M src/plone/app/theming/browser/controlpanel.py
Repository: plone.app.theming

Branch: refs/heads/master
Date: 2020-09-24T09:45:18+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: plone/plone.app.theming@a784c2f

Merge pull request #192 from plone/zope5

Fixed WrongContainedType for hostnameBlackList on Zope 5.

Files changed:
A news/183.bugfix
M src/plone/app/theming/browser/controlpanel.pt
M src/plone/app/theming/browser/controlpanel.py
  • Loading branch information
jensens committed Sep 24, 2020
1 parent 15a11ed commit 6469f37
Showing 1 changed file with 67 additions and 7 deletions.
74 changes: 67 additions & 7 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,75 @@
Repository: plone.namedfile
Repository: plone.app.theming


Branch: refs/heads/master
Date: 2020-09-22T15:54:24+02:00
Author: Jürgen Gmach (jugmac00) <juergen.gmach@googlemail.com>
Commit: https://github.com/plone/plone.namedfile/commit/14c1a3539cee99c3983adeb28eca5117272b7591
Date: 2020-09-23T23:58:51+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.app.theming/commit/88d90a49188d4aba5b188093a47ac546e1ee9ed2

Fix formatting
Fixed WrongContainedType for hostnameBlackList on Zope 5.

See also https://github.com/plone/plone.app.theming/issues/183.

This reverts commit 9c64d46bf54ebf5259a8ccf400d329991a2cb70a
which was itself a revert of "fix hostnameBlacklist (Theming ControlPanel) in Py3"

In Plone 6 (with Zope 5) this is needed again, because `processInputs` no longer exists.

Files changed:
A news/183.bugfix
M src/plone/app/theming/browser/controlpanel.pt
M src/plone/app/theming/browser/controlpanel.py

b'diff --git a/news/183.bugfix b/news/183.bugfix\nnew file mode 100644\nindex 0000000..0a643a9\n--- /dev/null\n+++ b/news/183.bugfix\n@@ -0,0 +1,3 @@\n+Fixed WrongContainedType for hostnameBlackList on Zope 5.\n+See also `issue 183 <https://github.com/plone/plone.app.theming/issues/183>`_.\n+[maurits]\ndiff --git a/src/plone/app/theming/browser/controlpanel.pt b/src/plone/app/theming/browser/controlpanel.pt\nindex 5471f82..89665e7 100644\n--- a/src/plone/app/theming/browser/controlpanel.pt\n+++ b/src/plone/app/theming/browser/controlpanel.pt\n@@ -460,7 +460,7 @@\n <div\n tal:define="error errors/hostnameBlacklist | nothing;\n hostnameBlacklist view/theme_settings/hostnameBlacklist | python:[];\n- hostnameBlacklist python:request.get(\'hostnameBlacklist\', hostnameBlacklist)"\n+ hostnameBlacklist python: view.hostname_blacklist or hostnameBlacklist"\n tal:attributes="class python:\'field error\' if error else \'field\'">\n \n <label for="hostnameBlacklist" i18n:translate="label_hostname_blacklist">Unthemed host names</label>\n@@ -481,7 +481,7 @@\n id="hostnameBlacklist"\n rows="5"\n cols="50"\n- tal:content="python:\'\\n\'.join(hostnameBlacklist)"\n+ tal:content="python: \'\\n\'.join(hostnameBlacklist)"\n ></textarea>\n \n </div>\ndiff --git a/src/plone/app/theming/browser/controlpanel.py b/src/plone/app/theming/browser/controlpanel.py\nindex 3a51928..7376eab 100644\n--- a/src/plone/app/theming/browser/controlpanel.py\n+++ b/src/plone/app/theming/browser/controlpanel.py\n@@ -60,6 +60,13 @@ def site_url(self):\n """\n return getSite().absolute_url()\n \n+ @property\n+ def hostname_blacklist(self):\n+ hostname_blacklist = self.request.get(\'hostnameBlacklist\', [])\n+ if six.PY2:\n+ return hostname_blacklist\n+ return [host.decode() for host in hostname_blacklist]\n+\n def __call__(self):\n self.pskin = getToolByName(self.context, \'portal_skins\')\n if self.update():\n@@ -175,8 +182,6 @@ def update(self):\n prefix = form.get(\'absolutePrefix\', None)\n doctype = str(form.get(\'doctype\', ""))\n \n- hostnameBlacklist = form.get(\'hostnameBlacklist\', [])\n-\n parameterExpressions = {}\n parameterExpressionsList = form.get(\'parameterExpressions\', [])\n \n@@ -210,7 +215,7 @@ def update(self):\n self.theme_settings.rules = rules\n self.theme_settings.absolutePrefix = prefix\n self.theme_settings.parameterExpressions = parameterExpressions\n- self.theme_settings.hostnameBlacklist = hostnameBlacklist\n+ self.theme_settings.hostnameBlacklist = self.hostname_blacklist\n if custom_css != self.theme_settings.custom_css:\n self.theme_settings.custom_css_timestamp = datetime.now()\n self.theme_settings.custom_css = custom_css\n'

Repository: plone.app.theming


Branch: refs/heads/master
Date: 2020-09-24T00:06:17+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.app.theming/commit/bbed30e8b2d4968f674ee12afc1a4fb3ca97e08a

Call safe_nativestring on hostnameBlacklist.

That should work on Py 2 and 3 and Plone 5.2 and 6.0.

Files changed:
M src/plone/app/theming/browser/controlpanel.py

b"diff --git a/src/plone/app/theming/browser/controlpanel.py b/src/plone/app/theming/browser/controlpanel.py\nindex 7376eab..bc178ce 100644\n--- a/src/plone/app/theming/browser/controlpanel.py\n+++ b/src/plone/app/theming/browser/controlpanel.py\n@@ -21,6 +21,7 @@\n from plone.resource.utils import queryResourceDirectory\n from Products.CMFCore.utils import getToolByName\n from Products.CMFPlone.utils import safe_unicode\n+from Products.CMFPlone.utils import safe_nativestring\n from Products.CMFPlone.interfaces import ILinkSchema\n from Products.statusmessages.interfaces import IStatusMessage\n from zope.component import getMultiAdapter\n@@ -63,9 +64,7 @@ def site_url(self):\n @property\n def hostname_blacklist(self):\n hostname_blacklist = self.request.get('hostnameBlacklist', [])\n- if six.PY2:\n- return hostname_blacklist\n- return [host.decode() for host in hostname_blacklist]\n+ return [safe_nativestring(host) for host in hostname_blacklist]\n \n def __call__(self):\n self.pskin = getToolByName(self.context, 'portal_skins')\n"

Repository: plone.app.theming


Branch: refs/heads/master
Date: 2020-09-24T00:09:26+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.app.theming/commit/8a67c217a8ca1bf8e50ddf04803e30215ac3f656

hostnameBlacklist: PY2 needs no changes.

Files changed:
M src/plone/app/theming/browser/controlpanel.py

b"diff --git a/src/plone/app/theming/browser/controlpanel.py b/src/plone/app/theming/browser/controlpanel.py\nindex bc178ce..746d6ea 100644\n--- a/src/plone/app/theming/browser/controlpanel.py\n+++ b/src/plone/app/theming/browser/controlpanel.py\n@@ -64,6 +64,8 @@ def site_url(self):\n @property\n def hostname_blacklist(self):\n hostname_blacklist = self.request.get('hostnameBlacklist', [])\n+ if six.PY2:\n+ return hostname_blacklist\n return [safe_nativestring(host) for host in hostname_blacklist]\n \n def __call__(self):\n"

Repository: plone.app.theming


Branch: refs/heads/master
Date: 2020-09-24T09:45:18+02:00
Author: Jens W. Klein (jensens) <jk@kleinundpartner.at>
Commit: https://github.com/plone/plone.app.theming/commit/a784c2f7f5724ccb13b24dcada76595a19065e72

Merge pull request #192 from plone/zope5

Fixed WrongContainedType for hostnameBlackList on Zope 5.

Files changed:
M CHANGES.rst
A news/183.bugfix
M src/plone/app/theming/browser/controlpanel.pt
M src/plone/app/theming/browser/controlpanel.py

b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 64e6420..e5e53a0 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -14,8 +14,8 @@ Changelog\n New features:\n \n \n-- - Range support (https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests)\n- [mamico] (#86)\n+- Range support (https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests)\n+ [mamico] (#86)\n \n \n 5.3.1 (2020-04-30)\n'
b'diff --git a/news/183.bugfix b/news/183.bugfix\nnew file mode 100644\nindex 0000000..0a643a9\n--- /dev/null\n+++ b/news/183.bugfix\n@@ -0,0 +1,3 @@\n+Fixed WrongContainedType for hostnameBlackList on Zope 5.\n+See also `issue 183 <https://github.com/plone/plone.app.theming/issues/183>`_.\n+[maurits]\ndiff --git a/src/plone/app/theming/browser/controlpanel.pt b/src/plone/app/theming/browser/controlpanel.pt\nindex 5471f82..89665e7 100644\n--- a/src/plone/app/theming/browser/controlpanel.pt\n+++ b/src/plone/app/theming/browser/controlpanel.pt\n@@ -460,7 +460,7 @@\n <div\n tal:define="error errors/hostnameBlacklist | nothing;\n hostnameBlacklist view/theme_settings/hostnameBlacklist | python:[];\n- hostnameBlacklist python:request.get(\'hostnameBlacklist\', hostnameBlacklist)"\n+ hostnameBlacklist python: view.hostname_blacklist or hostnameBlacklist"\n tal:attributes="class python:\'field error\' if error else \'field\'">\n \n <label for="hostnameBlacklist" i18n:translate="label_hostname_blacklist">Unthemed host names</label>\n@@ -481,7 +481,7 @@\n id="hostnameBlacklist"\n rows="5"\n cols="50"\n- tal:content="python:\'\\n\'.join(hostnameBlacklist)"\n+ tal:content="python: \'\\n\'.join(hostnameBlacklist)"\n ></textarea>\n \n </div>\ndiff --git a/src/plone/app/theming/browser/controlpanel.py b/src/plone/app/theming/browser/controlpanel.py\nindex 3a51928..746d6ea 100644\n--- a/src/plone/app/theming/browser/controlpanel.py\n+++ b/src/plone/app/theming/browser/controlpanel.py\n@@ -21,6 +21,7 @@\n from plone.resource.utils import queryResourceDirectory\n from Products.CMFCore.utils import getToolByName\n from Products.CMFPlone.utils import safe_unicode\n+from Products.CMFPlone.utils import safe_nativestring\n from Products.CMFPlone.interfaces import ILinkSchema\n from Products.statusmessages.interfaces import IStatusMessage\n from zope.component import getMultiAdapter\n@@ -60,6 +61,13 @@ def site_url(self):\n """\n return getSite().absolute_url()\n \n+ @property\n+ def hostname_blacklist(self):\n+ hostname_blacklist = self.request.get(\'hostnameBlacklist\', [])\n+ if six.PY2:\n+ return hostname_blacklist\n+ return [safe_nativestring(host) for host in hostname_blacklist]\n+\n def __call__(self):\n self.pskin = getToolByName(self.context, \'portal_skins\')\n if self.update():\n@@ -175,8 +183,6 @@ def update(self):\n prefix = form.get(\'absolutePrefix\', None)\n doctype = str(form.get(\'doctype\', ""))\n \n- hostnameBlacklist = form.get(\'hostnameBlacklist\', [])\n-\n parameterExpressions = {}\n parameterExpressionsList = form.get(\'parameterExpressions\', [])\n \n@@ -210,7 +216,7 @@ def update(self):\n self.theme_settings.rules = rules\n self.theme_settings.absolutePrefix = prefix\n self.theme_settings.parameterExpressions = parameterExpressions\n- self.theme_settings.hostnameBlacklist = hostnameBlacklist\n+ self.theme_settings.hostnameBlacklist = self.hostname_blacklist\n if custom_css != self.theme_settings.custom_css:\n self.theme_settings.custom_css_timestamp = datetime.now()\n self.theme_settings.custom_css = custom_css\n'

0 comments on commit 6469f37

Please sign in to comment.