Skip to content

Commit

Permalink
[fc] Repository: plone.app.debugtoolbar
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2021-12-19T16:51:18+01:00
Author: ale-rt (ale-rt) <[email protected]>
Commit: plone/plone.app.debugtoolbar@c1a66f4

Fix a compatibility issue with Python 3.8

Fixes #27

Files changed:
A news/27.bugfix
M src/plone/app/debugtoolbar/browser/interactive.py
Repository: plone.app.debugtoolbar

Branch: refs/heads/master
Date: 2021-12-20T11:46:18+01:00
Author: Jens W. Klein (jensens) <[email protected]>
Commit: plone/plone.app.debugtoolbar@57a8b1e

Merge pull request #28 from plone/27.bugfix

Fix a compatibility issue with Python 3.8

Files changed:
A news/27.bugfix
M src/plone/app/debugtoolbar/browser/interactive.py
  • Loading branch information
jensens committed Dec 20, 2021
1 parent 40bf757 commit f02de3a
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
Repository: Products.CMFPlone
Repository: plone.app.debugtoolbar


Branch: refs/heads/master
Date: 2021-12-20T10:28:57+01:00
Author: Maurits van Rees (mauritsvanrees) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/26daffb4ebcef128c1fe66669a36d58ce29a9228
Date: 2021-12-19T16:51:18+01:00
Author: ale-rt (ale-rt) <[email protected]>
Commit: https://github.com/plone/plone.app.debugtoolbar/commit/c1a66f4f872db6bcd7a15418b00daf99b6c8cfcd

Test-only fix: in test_controlpanel_relations flush the index queue.
Fix a compatibility issue with Python 3.8

Needed for https://github.com/plone/plone.app.uuid/pull/11
This uuid PR changes code to not do a full catalog query, but it uses some catalog index internals.
Result for two tests in CMFPlone is that the index queue is not flushed, which leads to inconsistent results.
This fixes it.

Internal testing detail only, so I did not add a news snippet.
Fixes #27

Files changed:
M Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py
A news/27.bugfix
M src/plone/app/debugtoolbar/browser/interactive.py

b"diff --git a/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py b/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py\nindex 07c0d232ec..a6bf021866 100644\n--- a/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py\n+++ b/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py\n@@ -82,6 +82,9 @@ def test_rebuild_relations(self):\n # api.relation.create(doc1, doc2, 'relatedItems')\n # api.relation.create(doc1, doc3, 'relatedItems')\n \n+ # Make sure the catalog index queue is flushed.\n+ self.portal.portal_catalog.searchResults({})\n+\n stats, broken = get_relations_stats()\n self.assertEqual(dict(stats), {'relatedItems': 2})\n self.assertEqual(dict(broken), {})\n@@ -134,6 +137,9 @@ def test_rebuild_relations_with_intid(self):\n # api.relation.create(doc1, doc2, 'relatedItems')\n # api.relation.create(doc1, doc3, 'relatedItems')\n \n+ # Make sure the catalog index queue is flushed.\n+ self.portal.portal_catalog.searchResults({})\n+\n stats, broken = get_relations_stats()\n self.assertEqual(dict(stats), {'relatedItems': 2})\n self.assertEqual(dict(broken), {})\n"
b'diff --git a/news/27.bugfix b/news/27.bugfix\nnew file mode 100644\nindex 0000000..3c93a73\n--- /dev/null\n+++ b/news/27.bugfix\n@@ -0,0 +1 @@\n+Fix a compatibility issue with Python 3.8\ndiff --git a/src/plone/app/debugtoolbar/browser/interactive.py b/src/plone/app/debugtoolbar/browser/interactive.py\nindex 05d7605..7ec35a7 100644\n--- a/src/plone/app/debugtoolbar/browser/interactive.py\n+++ b/src/plone/app/debugtoolbar/browser/interactive.py\n@@ -1,6 +1,5 @@\n # -*- coding: utf-8 -*-\n import re\n-import cgi\n import threading\n import traceback\n import six\n@@ -18,6 +17,13 @@\n from Products.PageTemplates.Expressions import getEngine\n from Products.CMFPlone.PloneBaseTool import createExprContext\n \n+\n+try:\n+ from html import escape\n+except ImportError:\n+ from cgi import escape\n+\n+\n class Variables(object):\n """Store local variables. Allow one set of variables per user id, and\n invalidate if the path of the context changes.\n@@ -58,7 +64,8 @@ def htmlQuote(v):\n # Borrowed from Paste\n if v is None:\n return \'\'\n- return cgi.escape(str(v), 1)\n+ return escape(str(v), 1)\n+\n \n def preserveWhitespace(v, quote=True):\n # Borrowed from Paste\n'

Repository: Products.CMFPlone
Repository: plone.app.debugtoolbar


Branch: refs/heads/master
Date: 2021-12-20T11:45:39+01:00
Date: 2021-12-20T11:46:18+01:00
Author: Jens W. Klein (jensens) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/429d727151959a5ce699638189f135fe2dd8f952
Commit: https://github.com/plone/plone.app.debugtoolbar/commit/57a8b1eed9db3501c6fc565c04b5c642d95e18d9

Merge pull request #3384 from plone/maurits-test-controlpanel-relations-flush-index-queue
Merge pull request #28 from plone/27.bugfix

Test-only fix: in test_controlpanel_relations flush the index queue.
Fix a compatibility issue with Python 3.8

Files changed:
M Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py
A news/27.bugfix
M src/plone/app/debugtoolbar/browser/interactive.py

b"diff --git a/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py b/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py\nindex 07c0d232ec..a6bf021866 100644\n--- a/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py\n+++ b/Products/CMFPlone/controlpanel/tests/test_controlpanel_relations.py\n@@ -82,6 +82,9 @@ def test_rebuild_relations(self):\n # api.relation.create(doc1, doc2, 'relatedItems')\n # api.relation.create(doc1, doc3, 'relatedItems')\n \n+ # Make sure the catalog index queue is flushed.\n+ self.portal.portal_catalog.searchResults({})\n+\n stats, broken = get_relations_stats()\n self.assertEqual(dict(stats), {'relatedItems': 2})\n self.assertEqual(dict(broken), {})\n@@ -134,6 +137,9 @@ def test_rebuild_relations_with_intid(self):\n # api.relation.create(doc1, doc2, 'relatedItems')\n # api.relation.create(doc1, doc3, 'relatedItems')\n \n+ # Make sure the catalog index queue is flushed.\n+ self.portal.portal_catalog.searchResults({})\n+\n stats, broken = get_relations_stats()\n self.assertEqual(dict(stats), {'relatedItems': 2})\n self.assertEqual(dict(broken), {})\n"
b'diff --git a/news/27.bugfix b/news/27.bugfix\nnew file mode 100644\nindex 0000000..3c93a73\n--- /dev/null\n+++ b/news/27.bugfix\n@@ -0,0 +1 @@\n+Fix a compatibility issue with Python 3.8\ndiff --git a/src/plone/app/debugtoolbar/browser/interactive.py b/src/plone/app/debugtoolbar/browser/interactive.py\nindex 05d7605..7ec35a7 100644\n--- a/src/plone/app/debugtoolbar/browser/interactive.py\n+++ b/src/plone/app/debugtoolbar/browser/interactive.py\n@@ -1,6 +1,5 @@\n # -*- coding: utf-8 -*-\n import re\n-import cgi\n import threading\n import traceback\n import six\n@@ -18,6 +17,13 @@\n from Products.PageTemplates.Expressions import getEngine\n from Products.CMFPlone.PloneBaseTool import createExprContext\n \n+\n+try:\n+ from html import escape\n+except ImportError:\n+ from cgi import escape\n+\n+\n class Variables(object):\n """Store local variables. Allow one set of variables per user id, and\n invalidate if the path of the context changes.\n@@ -58,7 +64,8 @@ def htmlQuote(v):\n # Borrowed from Paste\n if v is None:\n return \'\'\n- return cgi.escape(str(v), 1)\n+ return escape(str(v), 1)\n+\n \n def preserveWhitespace(v, quote=True):\n # Borrowed from Paste\n'

0 comments on commit f02de3a

Please sign in to comment.