Skip to content

Commit

Permalink
[fc] Repository: plone.restapi
Browse files Browse the repository at this point in the history
Branch: refs/heads/main
Date: 2024-09-04T21:43:29+02:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: plone/plone.restapi@7b1f0f4

Explicitly globally disable comments in the tests that need it. (#1805)

In Plone 6.1, when you actively activate plone.app.discussion, we may globally enable comments by default.
This is when plone/plone.app.discussion#244 gets merged.

We already had eight or so tests that explicitly globally enable comments.
Now we explicitly globally disable them in two others.
Then the tests work in Plone 6.0 and 6.1.

See two test failures here for the plone.app.discussion PR:
https://jenkins.plone.org/job/pull-request-6.1-3.10/311/

Files changed:
A news/244.tests
M src/plone/restapi/tests/test_dxcontent_serializer.py
  • Loading branch information
mauritsvanrees committed Sep 4, 2024
1 parent b3724c9 commit 1b09788
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
Repository: plone.app.theming
Repository: plone.restapi


Branch: refs/heads/master
Date: 2024-09-04T18:13:09+02:00
Author: Johannes Raggam (thet) <[email protected]>
Commit: https://github.com/plone/plone.app.theming/commit/61ef90d91ec1e9c2f7a3e806d006102784ba1aab
Branch: refs/heads/main
Date: 2024-09-04T21:43:29+02:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: https://github.com/plone/plone.restapi/commit/7b1f0f4c4bff5cba26cf7925e306cfa12fc2c3b3

Minor optimization to disable Diazo theming via "X-Theme-Disabled" a tick earlier.
Explicitly globally disable comments in the tests that need it. (#1805)

Files changed:
A news/244.internal
M src/plone/app/theming/policy.py

b'diff --git a/news/244.internal b/news/244.internal\nnew file mode 100644\nindex 00000000..4fea9be5\n--- /dev/null\n+++ b/news/244.internal\n@@ -0,0 +1,2 @@\n+Minor optimization to disable Diazo theming via `X-Theme-Disabled` a tick earlier.\n+[thet]\ndiff --git a/src/plone/app/theming/policy.py b/src/plone/app/theming/policy.py\nindex d837ff22..227b7b4d 100644\n--- a/src/plone/app/theming/policy.py\n+++ b/src/plone/app/theming/policy.py\n@@ -67,14 +67,14 @@ def getCurrentTheme(self):\n def isThemeEnabled(self, settings=None):\n """Whether theming is enabled."""\n \n- # Resolve debug_mode late (i.e. not on import time) since it may\n- # be set during import or test setup time\n- debug_mode = getConfiguration().debug_mode\n-\n # Disable theming if the response sets a header\n if self.request.response.getHeader("X-Theme-Disabled"):\n return False\n \n+ # Resolve debug_mode late (i.e. not on import time) since it may\n+ # be set during import or test setup time\n+ debug_mode = getConfiguration().debug_mode\n+\n # Check for diazo.off request parameter\n true_vals = ("1", "y", "yes", "t", "true")\n if debug_mode and self.request.get("diazo.off", "").lower() in true_vals:\n'

Repository: plone.app.theming


Branch: refs/heads/master
Date: 2024-09-04T21:31:06+02:00
Author: Peter Mathis (petschki) <[email protected]>
Commit: https://github.com/plone/plone.app.theming/commit/0f5a53f81114d24299763b28580aa07114d43eca

Merge pull request #244 from plone/thet-minor-opt
In Plone 6.1, when you actively activate plone.app.discussion, we may globally enable comments by default.
This is when https://github.com/plone/plone.app.discussion/pull/244 gets merged.

We already had eight or so tests that explicitly globally enable comments.
Now we explicitly globally disable them in two others.
Then the tests work in Plone 6.0 and 6.1.

See two test failures here for the plone.app.discussion PR:
https://jenkins.plone.org/job/pull-request-6.1-3.10/311/

Files changed:
A news/244.internal
M src/plone/app/theming/policy.py
A news/244.tests
M src/plone/restapi/tests/test_dxcontent_serializer.py

b'diff --git a/news/244.internal b/news/244.internal\nnew file mode 100644\nindex 00000000..4fea9be5\n--- /dev/null\n+++ b/news/244.internal\n@@ -0,0 +1,2 @@\n+Minor optimization to disable Diazo theming via `X-Theme-Disabled` a tick earlier.\n+[thet]\ndiff --git a/src/plone/app/theming/policy.py b/src/plone/app/theming/policy.py\nindex d837ff22..227b7b4d 100644\n--- a/src/plone/app/theming/policy.py\n+++ b/src/plone/app/theming/policy.py\n@@ -67,14 +67,14 @@ def getCurrentTheme(self):\n def isThemeEnabled(self, settings=None):\n """Whether theming is enabled."""\n \n- # Resolve debug_mode late (i.e. not on import time) since it may\n- # be set during import or test setup time\n- debug_mode = getConfiguration().debug_mode\n-\n # Disable theming if the response sets a header\n if self.request.response.getHeader("X-Theme-Disabled"):\n return False\n \n+ # Resolve debug_mode late (i.e. not on import time) since it may\n+ # be set during import or test setup time\n+ debug_mode = getConfiguration().debug_mode\n+\n # Check for diazo.off request parameter\n true_vals = ("1", "y", "yes", "t", "true")\n if debug_mode and self.request.get("diazo.off", "").lower() in true_vals:\n'
b'diff --git a/news/244.tests b/news/244.tests\nnew file mode 100644\nindex 000000000..0ee4acc1f\n--- /dev/null\n+++ b/news/244.tests\n@@ -0,0 +1,2 @@\n+Explicitly globally disable comments in the tests that need it.\n+[maurits]\n\\ No newline at end of file\ndiff --git a/src/plone/restapi/tests/test_dxcontent_serializer.py b/src/plone/restapi/tests/test_dxcontent_serializer.py\nindex 789cf865f..6fd514956 100644\n--- a/src/plone/restapi/tests/test_dxcontent_serializer.py\n+++ b/src/plone/restapi/tests/test_dxcontent_serializer.py\n@@ -527,6 +527,9 @@ def test_allow_discussion_by_default(self):\n self.assertEqual(False, obj["allow_discussion"])\n \n def test_allow_discussion_obj_instance_allows_but_not_global_enabled(self):\n+ registry = queryUtility(IRegistry)\n+ settings = registry.forInterface(IDiscussionSettings, check=False)\n+ settings.globally_enabled = False\n self.portal.invokeFactory("Document", id="doc2")\n self.portal.doc2.allow_discussion = True\n serializer = getMultiAdapter((self.portal.doc2, self.request), ISerializeToJson)\n@@ -536,6 +539,9 @@ def test_allow_discussion_obj_instance_allows_but_not_global_enabled(self):\n self.assertEqual(False, obj["allow_discussion"])\n \n def test_allow_discussion_fti_allows_not_global_enabled(self):\n+ registry = queryUtility(IRegistry)\n+ settings = registry.forInterface(IDiscussionSettings, check=False)\n+ settings.globally_enabled = False\n self.portal.invokeFactory("Document", id="doc2")\n portal_types = getToolByName(self.portal, "portal_types")\n document_fti = getattr(portal_types, self.portal.doc2.portal_type)\n'

0 comments on commit 1b09788

Please sign in to comment.