Skip to content

Commit

Permalink
[fc] Repository: Products.CMFPlone
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2023-11-29T12:41:08+01:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/Products.CMFPlone@f120f36

handle parenthesis inside quotes

Files changed:
A news/3879.bugfix
M Products/CMFPlone/browser/search.py
M Products/CMFPlone/tests/testSearch.py
Repository: Products.CMFPlone

Branch: refs/heads/master
Date: 2023-12-07T08:36:50+01:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: plone/Products.CMFPlone@e05fdb4

Merge branch 'master' into erral-issue-3879-master

Files changed:
A news/3873.bugfix
A news/3875.bugfix
M Products/CMFPlone/browser/syndication/adapters.py
M Products/CMFPlone/browser/templates/plone-overview.pt
Repository: Products.CMFPlone

Branch: refs/heads/master
Date: 2023-12-14T12:20:14+01:00
Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl>
Commit: plone/Products.CMFPlone@1e6ba8a

Merge pull request #3881 from plone/erral-issue-3879-master

handle parenthesis inside quotes

Files changed:
A news/3879.bugfix
M Products/CMFPlone/browser/search.py
M Products/CMFPlone/tests/testSearch.py
  • Loading branch information
mauritsvanrees committed Dec 14, 2023
1 parent 181282d commit 0f09a33
Showing 1 changed file with 45 additions and 14 deletions.
59 changes: 45 additions & 14 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,54 @@
Repository: plone.app.theming
Repository: Products.CMFPlone


Branch: refs/heads/master
Date: 2023-12-13T20:57:55+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: https://github.com/plone/plone.app.theming/commit/342cbb9ed967132855518bb6d8225785d76abeb5
Date: 2023-11-29T12:41:08+01:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/Products.CMFPlone/commit/f120f3659b77fe09ececce5a23b7200d01273d5f

Fix AttributeError in custom.css: "module 'wsgiref' has no attribute 'handlers'". (#231)
handle parenthesis inside quotes

This problem is usually hidden if `plone.app.caching` is available.
Fixes https://github.com/plone/plone.app.theming/issues/230

And this PR adds the first test for `custom.css`, which indeed shows this problem.
This fixes https://github.com/plone/plone.app.theming/issues/190
Files changed:
A news/3879.bugfix
M Products/CMFPlone/browser/search.py
M Products/CMFPlone/tests/testSearch.py

b'diff --git a/Products/CMFPlone/browser/search.py b/Products/CMFPlone/browser/search.py\nindex 108a8f0b54..84503505dd 100644\n--- a/Products/CMFPlone/browser/search.py\n+++ b/Products/CMFPlone/browser/search.py\n@@ -45,10 +45,11 @@ def quote(term):\n # being parsed as logical query atoms.\n if term.lower() in ("and", "or", "not"):\n term = \'"%s"\' % term\n- return term\n+ return quote_chars(term)\n \n \n def munge_search_term(query):\n+ original_query = query\n for char in BAD_CHARS:\n query = query.replace(char, " ")\n \n@@ -67,7 +68,7 @@ def munge_search_term(query):\n \n r += map(quote, query.strip().split())\n r = " AND ".join(r)\n- r = quote_chars(r) + ("*" if r and not r.endswith(\'"\') else "")\n+ r = r + ("*" if r and not original_query.endswith(\'"\') else "")\n return r\n \n \ndiff --git a/Products/CMFPlone/tests/testSearch.py b/Products/CMFPlone/tests/testSearch.py\nindex 54b43d8861..e1d00b8567 100644\n--- a/Products/CMFPlone/tests/testSearch.py\n+++ b/Products/CMFPlone/tests/testSearch.py\n@@ -364,6 +364,21 @@ def test_munge_search_term(self):\n \'" spam ham "\',\n \'"spam ham"\',\n ),\n+ (\n+ # quoted term with inner parenthesis\n+ \'"spam (ham)"\',\n+ \'"spam (ham)"\',\n+ ),\n+ (\n+ # quoted term with inner parenthesis\n+ \'"spam" (ham)\',\n+ \'"spam" AND "("ham")"*\',\n+ ),\n+ (\n+ # quoted term with inner parenthesis\n+ \'"(spam ham)"\',\n+ \'"(spam ham)"\',\n+ ),\n (\n # mixed cases\n "Spam hAm",\ndiff --git a/news/3879.bugfix b/news/3879.bugfix\nnew file mode 100644\nindex 0000000000..2b1cb9b691\n--- /dev/null\n+++ b/news/3879.bugfix\n@@ -0,0 +1,2 @@\n+Handle catalog queries with parenthesis inside quotes\n+[erral]\n'

Repository: Products.CMFPlone


Branch: refs/heads/master
Date: 2023-12-07T08:36:50+01:00
Author: Mikel Larreategi (erral) <mlarreategi@codesyntax.com>
Commit: https://github.com/plone/Products.CMFPlone/commit/e05fdb45ede40bf7f237b4699908b7c3b6fb0256

Merge branch 'master' into erral-issue-3879-master

Files changed:
A news/3873.bugfix
A news/3875.bugfix
M Products/CMFPlone/browser/syndication/adapters.py
M Products/CMFPlone/browser/templates/plone-overview.pt

b'diff --git a/Products/CMFPlone/browser/syndication/adapters.py b/Products/CMFPlone/browser/syndication/adapters.py\nindex 68475f5222..4d51bb1507 100644\n--- a/Products/CMFPlone/browser/syndication/adapters.py\n+++ b/Products/CMFPlone/browser/syndication/adapters.py\n@@ -1,6 +1,6 @@\n from DateTime import DateTime\n from OFS.interfaces import IItem\n-from plone.app.contenttypes.behaviors.leadimage import ILeadImage\n+from plone.app.contenttypes.behaviors.leadimage import ILeadImageBehavior\n from plone.base.interfaces.syndication import IFeed\n from plone.base.interfaces.syndication import IFeedItem\n from plone.base.interfaces.syndication import IFeedSettings\n@@ -271,7 +271,7 @@ class DexterityItem(BaseItem):\n def __init__(self, context, feed):\n super().__init__(context, feed)\n self.dexterity = IDexterityContent.providedBy(context)\n- lead = ILeadImage(self.context, None)\n+ lead = ILeadImageBehavior(self.context, None)\n if lead:\n if (\n lead.image\ndiff --git a/Products/CMFPlone/browser/templates/plone-overview.pt b/Products/CMFPlone/browser/templates/plone-overview.pt\nindex d84963c36b..035f0b4856 100644\n--- a/Products/CMFPlone/browser/templates/plone-overview.pt\n+++ b/Products/CMFPlone/browser/templates/plone-overview.pt\n@@ -92,7 +92,7 @@\n i18n:translate=""\n tal:condition="view/has_volto"\n href="${action}?site_id=Plone${site_number}&amp;classic=1"\n- >Create Classic Plone site</a>\n+ >Create Classic UI Plone site</a>\n <a class="btn btn-secondary"\n i18n:translate=""\n href="${action}?site_id=Plone${site_number}&amp;advanced=1"\n@@ -106,7 +106,7 @@\n an additional frontend service to use this setup.\n </p>\n <p i18n:translate="help_create_plone_site_buttons_2">\n- The \'Create Classic Plone site\' button creates a Plone site configured\n+ The \'Create Classic UI Plone site\' button creates a Plone site configured\n for HTML based output, as was already supported by previous Plone versions.\n Please consult our\n <a href="https://6.docs.plone.org/" title="Plone 6 developer documentation"\ndiff --git a/news/3873.bugfix b/news/3873.bugfix\nnew file mode 100644\nindex 0000000000..e201ecd08b\n--- /dev/null\n+++ b/news/3873.bugfix\n@@ -0,0 +1 @@\n+Corrected the name in a button and help text to "Classic UI" when creating a Plone site. @1letter\ndiff --git a/news/3875.bugfix b/news/3875.bugfix\nnew file mode 100644\nindex 0000000000..5ef04b030d\n--- /dev/null\n+++ b/news/3875.bugfix\n@@ -0,0 +1,2 @@\n+Correct the behavior interface for lead image in the syndication adapter.\n+[thet]\n'

Repository: Products.CMFPlone


Branch: refs/heads/master
Date: 2023-12-14T12:20:14+01:00
Author: Maurits van Rees (mauritsvanrees) <m.van.rees@zestsoftware.nl>
Commit: https://github.com/plone/Products.CMFPlone/commit/1e6ba8a6ca9e7163c8f71ba069dd34abc529ead4

Merge pull request #3881 from plone/erral-issue-3879-master

handle parenthesis inside quotes

Files changed:
A news/230.bugfix
M src/plone/app/theming/browser/custom_css.py
M src/plone/app/theming/tests/test_controlpanel.py
A news/3879.bugfix
M Products/CMFPlone/browser/search.py
M Products/CMFPlone/tests/testSearch.py

b'diff --git a/news/230.bugfix b/news/230.bugfix\nnew file mode 100644\nindex 00000000..05ffb7c6\n--- /dev/null\n+++ b/news/230.bugfix\n@@ -0,0 +1,2 @@\n+Fix AttributeError in ``custom.css``: "module \'wsgiref\' has no attribute \'handlers\'".\n+[maurits]\ndiff --git a/src/plone/app/theming/browser/custom_css.py b/src/plone/app/theming/browser/custom_css.py\nindex 135da816..bf252db3 100644\n--- a/src/plone/app/theming/browser/custom_css.py\n+++ b/src/plone/app/theming/browser/custom_css.py\n@@ -1,11 +1,11 @@\n from plone.app.theming.interfaces import IThemeSettings\n from plone.registry.interfaces import IRegistry\n from Products.Five.browser import BrowserView\n+from wsgiref.handlers import format_date_time\n from zope.component import getUtility\n \n import dateutil\n import time\n-import wsgiref\n \n \n class CustomCSSView(BrowserView):\n@@ -27,6 +27,6 @@ def __call__(self):\n # Format a Python datetime object as an RFC1123 date.\n self.request.response.setHeader(\n "Last-Modified",\n- wsgiref.handlers.format_date_time(time.mktime(dt.timetuple())),\n+ format_date_time(time.mktime(dt.timetuple())),\n )\n return theme_settings.custom_css\ndiff --git a/src/plone/app/theming/tests/test_controlpanel.py b/src/plone/app/theming/tests/test_controlpanel.py\nindex c56ab854..327ca6c7 100644\n--- a/src/plone/app/theming/tests/test_controlpanel.py\n+++ b/src/plone/app/theming/tests/test_controlpanel.py\n@@ -86,3 +86,27 @@ def test_upload_theme_file_withdata(self):\n \'{"failure": "error"}\', # TODO: Should be {\'success\':\'create\'}\n str(self.browser.contents),\n )\n+\n+ def test_custom_css(self):\n+ # By default custom.css is empty.\n+ self.browser.handleErrors = False\n+ self.browser.open("custom.css")\n+ self.assertEqual(self.browser.contents, "")\n+ self.assertEqual(\n+ self.browser.headers["Content-Type"],\n+ "text/css; charset=utf-8",\n+ )\n+\n+ # Go to the control panel and add custom css.\n+ self.goto_controlpanel()\n+ css = "body {background-color: blue;}"\n+ self.browser.getControl(name="custom_css").value = css\n+ self.browser.getControl(name="form.button.AdvancedSave").click()\n+\n+ # Check that the css is available.\n+ self.browser.open("custom.css")\n+ self.assertEqual(self.browser.contents, css)\n+ self.assertEqual(\n+ self.browser.headers["Content-Type"],\n+ "text/css; charset=utf-8",\n+ )\n'
b'diff --git a/Products/CMFPlone/browser/search.py b/Products/CMFPlone/browser/search.py\nindex 108a8f0b54..84503505dd 100644\n--- a/Products/CMFPlone/browser/search.py\n+++ b/Products/CMFPlone/browser/search.py\n@@ -45,10 +45,11 @@ def quote(term):\n # being parsed as logical query atoms.\n if term.lower() in ("and", "or", "not"):\n term = \'"%s"\' % term\n- return term\n+ return quote_chars(term)\n \n \n def munge_search_term(query):\n+ original_query = query\n for char in BAD_CHARS:\n query = query.replace(char, " ")\n \n@@ -67,7 +68,7 @@ def munge_search_term(query):\n \n r += map(quote, query.strip().split())\n r = " AND ".join(r)\n- r = quote_chars(r) + ("*" if r and not r.endswith(\'"\') else "")\n+ r = r + ("*" if r and not original_query.endswith(\'"\') else "")\n return r\n \n \ndiff --git a/Products/CMFPlone/tests/testSearch.py b/Products/CMFPlone/tests/testSearch.py\nindex 54b43d8861..e1d00b8567 100644\n--- a/Products/CMFPlone/tests/testSearch.py\n+++ b/Products/CMFPlone/tests/testSearch.py\n@@ -364,6 +364,21 @@ def test_munge_search_term(self):\n \'" spam ham "\',\n \'"spam ham"\',\n ),\n+ (\n+ # quoted term with inner parenthesis\n+ \'"spam (ham)"\',\n+ \'"spam (ham)"\',\n+ ),\n+ (\n+ # quoted term with inner parenthesis\n+ \'"spam" (ham)\',\n+ \'"spam" AND "("ham")"*\',\n+ ),\n+ (\n+ # quoted term with inner parenthesis\n+ \'"(spam ham)"\',\n+ \'"(spam ham)"\',\n+ ),\n (\n # mixed cases\n "Spam hAm",\ndiff --git a/news/3879.bugfix b/news/3879.bugfix\nnew file mode 100644\nindex 0000000000..2b1cb9b691\n--- /dev/null\n+++ b/news/3879.bugfix\n@@ -0,0 +1,2 @@\n+Handle catalog queries with parenthesis inside quotes\n+[erral]\n'

0 comments on commit 0f09a33

Please sign in to comment.