Skip to content

Commit

Permalink
[fc] Repository: plone.base
Browse files Browse the repository at this point in the history
Branch: refs/heads/main
Date: 2023-08-05T23:01:40+02:00
Author: Peter Mathis (petschki) <peter.mathis@kombinat.at>
Commit: plone/plone.base@b7bec3d

remove `modal` default value

Files changed:
M src/plone/base/interfaces/controlpanel.py
Repository: plone.base

Branch: refs/heads/main
Date: 2023-08-05T23:02:43+02:00
Author: Peter Mathis (petschki) <peter.mathis@kombinat.at>
Commit: plone/plone.base@895e696

changenote

Files changed:
A news/3801.bugfix
Repository: plone.base

Branch: refs/heads/main
Date: 2023-08-07T13:25:49+02:00
Author: Peter Mathis (petschki) <petschki@users.noreply.github.com>
Commit: plone/plone.base@2e7f014

Update news/3801.bugfix

Co-authored-by: Johannes Raggam &lt;thetetet@gmail.com&gt;

Files changed:
M news/3801.bugfix
Repository: plone.base

Branch: refs/heads/main
Date: 2023-08-11T19:16:10+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.base@9e6ac99

Merge pull request #49 from plone/action-modal-default-fix

Remove action property `modal` default value.

Files changed:
A news/3801.bugfix
M src/plone/base/interfaces/controlpanel.py
  • Loading branch information
mauritsvanrees committed Aug 11, 2023
1 parent 335fc13 commit 34aba46
Showing 1 changed file with 47 additions and 23 deletions.
70 changes: 47 additions & 23 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,65 @@
Repository: plone.app.multilingual
Repository: plone.base


Branch: refs/heads/7.x
Date: 2023-07-27T14:28:32+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.app.multilingual/commit/78cdb19b038b2979af482a8d9d7531a975948373
Branch: refs/heads/main
Date: 2023-08-05T23:01:40+02:00
Author: Peter Mathis (petschki) <peter.mathis@kombinat.at>
Commit: https://github.com/plone/plone.base/commit/b7bec3df40ec1387b6672811e047484a56a8e404

remove `modal` default value

Files changed:
M src/plone/base/interfaces/controlpanel.py

b'diff --git a/src/plone/base/interfaces/controlpanel.py b/src/plone/base/interfaces/controlpanel.py\nindex 13b092b..c1dca1c 100644\n--- a/src/plone/base/interfaces/controlpanel.py\n+++ b/src/plone/base/interfaces/controlpanel.py\n@@ -1963,7 +1963,6 @@ class IActionSchema(Interface):\n title=_("action_modal_settings", default="Settings for pat-plone-modal"),\n required=False,\n constraint=validate_json,\n- default=dump_json_to_text({}),\n )\n \n \n'

Repository: plone.base


Branch: refs/heads/main
Date: 2023-08-05T23:02:43+02:00
Author: Peter Mathis (petschki) <peter.mathis@kombinat.at>
Commit: https://github.com/plone/plone.base/commit/895e6969e6c4ae78a3031b792777faafaf9c717d

changenote

Files changed:
A news/3801.bugfix

b'diff --git a/news/3801.bugfix b/news/3801.bugfix\nnew file mode 100644\nindex 0000000..ab9ffee\n--- /dev/null\n+++ b/news/3801.bugfix\n@@ -0,0 +1,2 @@\n+Remove action property `modal` default value.\n+[petschki]\n'

Repository: plone.base


Fix setting Indonesian language cookie on site root.
Branch: refs/heads/main
Date: 2023-08-07T13:25:49+02:00
Author: Peter Mathis (petschki) <petschki@users.noreply.github.com>
Commit: https://github.com/plone/plone.base/commit/2e7f01461005c75433b2d7e18119b892f951f4d6

Must be id, not id-id.
See https://github.com/plone/plone.app.multilingual/issues/304
Update news/3801.bugfix

Also, use `ILanguageUtility.setLanguageCookie` instead of setting a cookie ourselves.
Co-authored-by: Johannes Raggam &lt;thetetet@gmail.com&gt;

Files changed:
A news/304.bugfix
M src/plone/app/multilingual/browser/switcher.py
M src/plone/app/multilingual/tests/test_switcher.py
M news/3801.bugfix

b'diff --git a/news/304.bugfix b/news/304.bugfix\nnew file mode 100644\nindex 000000000..1c7b509e6\n--- /dev/null\n+++ b/news/304.bugfix\n@@ -0,0 +1,2 @@\n+Fix setting Indonesian language cookie on site root: must be ``id``, not ``id-id``.\n+[maurits]\ndiff --git a/src/plone/app/multilingual/browser/switcher.py b/src/plone/app/multilingual/browser/switcher.py\nindex 3820bd320..6d815502b 100644\n--- a/src/plone/app/multilingual/browser/switcher.py\n+++ b/src/plone/app/multilingual/browser/switcher.py\n@@ -1,6 +1,8 @@\n from Acquisition import aq_inner\n+from plone.i18n.interfaces import ILanguageUtility\n from Products.CMFCore.utils import getToolByName\n from Products.Five import BrowserView\n+from zope.component import getUtility\n \n \n class LanguageSwitcher(BrowserView):\n@@ -26,8 +28,10 @@ def __call__(self):\n \n # We need to set the language cookie on the first response or it will\n # be set on the frontpage itself, making it uncachable\n- langCookie = self.request.cookies.get("I18N_LANGUAGE")\n- if not langCookie or langCookie != target:\n- self.request.response.setCookie("I18N_LANGUAGE", target, path="/")\n+ # In case of Indonesian, we need to use \'id\', not \'id-id\'.\n+ target = "id" if target == "id-id" else target\n+ tool = getUtility(ILanguageUtility)\n+ # setLanguageCookie calls getLanguageCookie, and only sets a cookie when needed.\n+ tool.setLanguageCookie(target, request=self.request)\n \n self.request.response.redirect(url, status=302)\ndiff --git a/src/plone/app/multilingual/tests/test_switcher.py b/src/plone/app/multilingual/tests/test_switcher.py\nindex 14a8ac6db..b145f5ba9 100644\n--- a/src/plone/app/multilingual/tests/test_switcher.py\n+++ b/src/plone/app/multilingual/tests/test_switcher.py\n@@ -34,12 +34,14 @@ def setUp(self):\n def test_switcher_redirects_to_default_english(self):\n self.browser.open(self.portal_url)\n self.assertEqual(self.browser.url, self.portal_url + "/en")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "en")\n \n def test_switcher_redirects_to_default_indonesian(self):\n self.language_tool.setDefaultLanguage("id")\n transaction.commit()\n self.browser.open(self.portal_url)\n self.assertEqual(self.browser.url, self.portal_url + "/id-id")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "id")\n \n def test_switcher_redirects_to_preferred_catalan(self):\n # Tell Plone that we prefer Catalan.\n@@ -48,6 +50,7 @@ def test_switcher_redirects_to_preferred_catalan(self):\n self.browser.open(self.portal_url)\n # We get redirected to our preferred language root folder.\n self.assertEqual(self.browser.url, self.portal_url + "/ca")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "ca")\n \n def test_switcher_redirects_to_preferred_indonesian(self):\n # Tell Plone that we prefer Indonesian.\n@@ -56,3 +59,4 @@ def test_switcher_redirects_to_preferred_indonesian(self):\n self.browser.open(self.portal_url)\n # We get redirected to our preferred language root folder.\n self.assertEqual(self.browser.url, self.portal_url + "/id-id")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "id")\n'
b'diff --git a/news/3801.bugfix b/news/3801.bugfix\nindex ab9ffee..9f7c73e 100644\n--- a/news/3801.bugfix\n+++ b/news/3801.bugfix\n@@ -1,2 +1,3 @@\n Remove action property `modal` default value.\n+Fixes: https://github.com/plone/Products.CMFPlone/issues/3801\n [petschki]\n'

Repository: plone.app.multilingual
Repository: plone.base


Branch: refs/heads/7.x
Date: 2023-08-11T12:44:33+02:00
Branch: refs/heads/main
Date: 2023-08-11T19:16:10+02:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.app.multilingual/commit/05ea121d77aa8c586352ee02459b569fd541d480
Commit: https://github.com/plone/plone.base/commit/9e6ac99a78c6bc896f754846d92591413416e4c3

Merge pull request #429 from plone/maurits-indonesian-cookie-7x
Merge pull request #49 from plone/action-modal-default-fix

Fix setting Indonesian language cookie on site root. [7.x]
Remove action property `modal` default value.

Files changed:
A news/304.bugfix
M src/plone/app/multilingual/browser/switcher.py
M src/plone/app/multilingual/tests/test_switcher.py
A news/3801.bugfix
M src/plone/base/interfaces/controlpanel.py

b'diff --git a/news/304.bugfix b/news/304.bugfix\nnew file mode 100644\nindex 000000000..1c7b509e6\n--- /dev/null\n+++ b/news/304.bugfix\n@@ -0,0 +1,2 @@\n+Fix setting Indonesian language cookie on site root: must be ``id``, not ``id-id``.\n+[maurits]\ndiff --git a/src/plone/app/multilingual/browser/switcher.py b/src/plone/app/multilingual/browser/switcher.py\nindex 3820bd320..6d815502b 100644\n--- a/src/plone/app/multilingual/browser/switcher.py\n+++ b/src/plone/app/multilingual/browser/switcher.py\n@@ -1,6 +1,8 @@\n from Acquisition import aq_inner\n+from plone.i18n.interfaces import ILanguageUtility\n from Products.CMFCore.utils import getToolByName\n from Products.Five import BrowserView\n+from zope.component import getUtility\n \n \n class LanguageSwitcher(BrowserView):\n@@ -26,8 +28,10 @@ def __call__(self):\n \n # We need to set the language cookie on the first response or it will\n # be set on the frontpage itself, making it uncachable\n- langCookie = self.request.cookies.get("I18N_LANGUAGE")\n- if not langCookie or langCookie != target:\n- self.request.response.setCookie("I18N_LANGUAGE", target, path="/")\n+ # In case of Indonesian, we need to use \'id\', not \'id-id\'.\n+ target = "id" if target == "id-id" else target\n+ tool = getUtility(ILanguageUtility)\n+ # setLanguageCookie calls getLanguageCookie, and only sets a cookie when needed.\n+ tool.setLanguageCookie(target, request=self.request)\n \n self.request.response.redirect(url, status=302)\ndiff --git a/src/plone/app/multilingual/tests/test_switcher.py b/src/plone/app/multilingual/tests/test_switcher.py\nindex 14a8ac6db..b145f5ba9 100644\n--- a/src/plone/app/multilingual/tests/test_switcher.py\n+++ b/src/plone/app/multilingual/tests/test_switcher.py\n@@ -34,12 +34,14 @@ def setUp(self):\n def test_switcher_redirects_to_default_english(self):\n self.browser.open(self.portal_url)\n self.assertEqual(self.browser.url, self.portal_url + "/en")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "en")\n \n def test_switcher_redirects_to_default_indonesian(self):\n self.language_tool.setDefaultLanguage("id")\n transaction.commit()\n self.browser.open(self.portal_url)\n self.assertEqual(self.browser.url, self.portal_url + "/id-id")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "id")\n \n def test_switcher_redirects_to_preferred_catalan(self):\n # Tell Plone that we prefer Catalan.\n@@ -48,6 +50,7 @@ def test_switcher_redirects_to_preferred_catalan(self):\n self.browser.open(self.portal_url)\n # We get redirected to our preferred language root folder.\n self.assertEqual(self.browser.url, self.portal_url + "/ca")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "ca")\n \n def test_switcher_redirects_to_preferred_indonesian(self):\n # Tell Plone that we prefer Indonesian.\n@@ -56,3 +59,4 @@ def test_switcher_redirects_to_preferred_indonesian(self):\n self.browser.open(self.portal_url)\n # We get redirected to our preferred language root folder.\n self.assertEqual(self.browser.url, self.portal_url + "/id-id")\n+ self.assertEqual(self.browser.cookies["I18N_LANGUAGE"], "id")\n'
b'diff --git a/news/3801.bugfix b/news/3801.bugfix\nnew file mode 100644\nindex 0000000..9f7c73e\n--- /dev/null\n+++ b/news/3801.bugfix\n@@ -0,0 +1,3 @@\n+Remove action property `modal` default value.\n+Fixes: https://github.com/plone/Products.CMFPlone/issues/3801\n+[petschki]\ndiff --git a/src/plone/base/interfaces/controlpanel.py b/src/plone/base/interfaces/controlpanel.py\nindex 13b092b..c1dca1c 100644\n--- a/src/plone/base/interfaces/controlpanel.py\n+++ b/src/plone/base/interfaces/controlpanel.py\n@@ -1963,7 +1963,6 @@ class IActionSchema(Interface):\n title=_("action_modal_settings", default="Settings for pat-plone-modal"),\n required=False,\n constraint=validate_json,\n- default=dump_json_to_text({}),\n )\n \n \n'

0 comments on commit 34aba46

Please sign in to comment.