-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fc] Repository: plone.app.querystring
Branch: refs/heads/master Date: 2023-11-29T13:33:12+01:00 Author: Mikel Larreategi (erral) <[email protected]> Commit: plone/plone.app.querystring@c66c920 handle parenthesis inside quotes Files changed: A news/139.bugfix M plone/app/querystring/querybuilder.py M plone/app/querystring/tests/testQueryBuilder.py Repository: plone.app.querystring Branch: refs/heads/master Date: 2023-11-29T13:35:51+01:00 Author: Mikel Larreategi (erral) <[email protected]> Commit: plone/plone.app.querystring@5b2909f run black Files changed: M plone/app/querystring/tests/testQueryBuilder.py Repository: plone.app.querystring Branch: refs/heads/master Date: 2023-12-14T12:20:43+01:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> Commit: plone/plone.app.querystring@84d730b Merge pull request #140 from plone/erral-issue-139 handle parenthesis inside quotes Files changed: A news/139.bugfix M plone/app/querystring/querybuilder.py M plone/app/querystring/tests/testQueryBuilder.py
- Loading branch information
1 parent
0f09a33
commit 546ed23
Showing
1 changed file
with
22 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,51 @@ | ||
Repository: Products.CMFPlone | ||
Repository: plone.app.querystring | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2023-11-29T12:41:08+01:00 | ||
Date: 2023-11-29T13:33:12+01:00 | ||
Author: Mikel Larreategi (erral) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/f120f3659b77fe09ececce5a23b7200d01273d5f | ||
Commit: https://github.com/plone/plone.app.querystring/commit/c66c920642887141ec6c9ac2fcf87f363d12de01 | ||
|
||
handle parenthesis inside quotes | ||
|
||
Files changed: | ||
A news/3879.bugfix | ||
M Products/CMFPlone/browser/search.py | ||
M Products/CMFPlone/tests/testSearch.py | ||
A news/139.bugfix | ||
M plone/app/querystring/querybuilder.py | ||
M plone/app/querystring/tests/testQueryBuilder.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' | ||
b'diff --git a/news/139.bugfix b/news/139.bugfix\nnew file mode 100644\nindex 0000000..ec4772e\n--- /dev/null\n+++ b/news/139.bugfix\n@@ -0,0 +1,2 @@\n+Handle parenthesis inside quotes\n+[erral]\ndiff --git a/plone/app/querystring/querybuilder.py b/plone/app/querystring/querybuilder.py\nindex d9ef15b..bd8978f 100644\n--- a/plone/app/querystring/querybuilder.py\n+++ b/plone/app/querystring/querybuilder.py\n@@ -44,10 +44,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@@ -66,7 +67,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/plone/app/querystring/tests/testQueryBuilder.py b/plone/app/querystring/tests/testQueryBuilder.py\nindex 4c39838..48b6e43 100644\n--- a/plone/app/querystring/tests/testQueryBuilder.py\n+++ b/plone/app/querystring/tests/testQueryBuilder.py\n@@ -326,6 +326,80 @@ def testQueryBuilderCustomQueryDoNotOverrideValues(self):\n self.assertEqual(results[0].Title(), "Collectionstestpage 2")\n \n \n+ def test_munge_search_term(self):\n+ from plone.app.querystring.querybuilder import _BAD_CHARS\n+ from plone.app.querystring.querybuilder import munge_search_term\n+\n+ search_term_tests = [\n+ (\n+ # search term\n+ "spam ham",\n+ "spam AND ham*",\n+ ),\n+ (\n+ # quoted term\n+ \'"spam ham"\',\n+ \'"spam ham"\',\n+ ),\n+ (\n+ # cleanup quoted terms\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",\n+ "Spam AND hAm*",\n+ ),\n+ (\n+ # mix quoting and unquoted\n+ \'let\\\'s eat some "ham and eggs " without spam \',\n+ \'"ham and eggs" AND let\\\'s AND eat AND some \' "AND without AND spam*",\n+ ),\n+ (\n+ \'test "Welcome" to "Plone" retest\',\n+ \'"Welcome" AND "Plone" AND test AND to AND retest*\',\n+ ),\n+ (\n+ # parentheses\n+ "spam (ham)",\n+ \'spam AND "("ham")"*\',\n+ ),\n+ (\n+ # special keywords\n+ "spam or not ham and eggs",\n+ \'spam AND "or" AND "not" AND ham AND "and" AND eggs*\',\n+ ),\n+ (\n+ # bad characters\n+ " ".join(_BAD_CHARS),\n+ "",\n+ ),\n+ (\n+ # weird input\n+ \'test ""Welcome" to "Plone"" retest\',\n+ \'"to" AND test AND WelcomePlone AND retest*\',\n+ ),\n+ ]\n+\n+ for _in, _out in search_term_tests:\n+ self.assertEqual(munge_search_term(_in), _out)\n+\n class TestQuerybuilderResultTypes(unittest.TestCase):\n layer = TEST_PROFILE_PLONEAPPQUERYSTRING_INTEGRATION_TESTING\n \n' | ||
|
||
Repository: Products.CMFPlone | ||
Repository: plone.app.querystring | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2023-12-07T08:36:50+01:00 | ||
Date: 2023-11-29T13:35:51+01:00 | ||
Author: Mikel Larreategi (erral) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/e05fdb45ede40bf7f237b4699908b7c3b6fb0256 | ||
Commit: https://github.com/plone/plone.app.querystring/commit/5b2909f448b6da18ddb5751acc6e2dffef4cbedd | ||
|
||
Merge branch 'master' into erral-issue-3879-master | ||
run black | ||
|
||
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 | ||
M plone/app/querystring/tests/testQueryBuilder.py | ||
|
||
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}&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}&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' | ||
b'diff --git a/plone/app/querystring/tests/testQueryBuilder.py b/plone/app/querystring/tests/testQueryBuilder.py\nindex 48b6e43..6a79bf0 100644\n--- a/plone/app/querystring/tests/testQueryBuilder.py\n+++ b/plone/app/querystring/tests/testQueryBuilder.py\n@@ -325,7 +325,6 @@ def testQueryBuilderCustomQueryDoNotOverrideValues(self):\n self.assertEqual(len(results), 1)\n self.assertEqual(results[0].Title(), "Collectionstestpage 2")\n \n-\n def test_munge_search_term(self):\n from plone.app.querystring.querybuilder import _BAD_CHARS\n from plone.app.querystring.querybuilder import munge_search_term\n@@ -400,6 +399,7 @@ def test_munge_search_term(self):\n for _in, _out in search_term_tests:\n self.assertEqual(munge_search_term(_in), _out)\n \n+\n class TestQuerybuilderResultTypes(unittest.TestCase):\n layer = TEST_PROFILE_PLONEAPPQUERYSTRING_INTEGRATION_TESTING\n \n' | ||
|
||
Repository: Products.CMFPlone | ||
Repository: plone.app.querystring | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2023-12-14T12:20:14+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/1e6ba8a6ca9e7163c8f71ba069dd34abc529ead4 | ||
Date: 2023-12-14T12:20:43+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.querystring/commit/84d730b65b1260c7eec85efcc3ab23116c150a2e | ||
|
||
Merge pull request #3881 from plone/erral-issue-3879-master | ||
Merge pull request #140 from plone/erral-issue-139 | ||
|
||
handle parenthesis inside quotes | ||
|
||
Files changed: | ||
A news/3879.bugfix | ||
M Products/CMFPlone/browser/search.py | ||
M Products/CMFPlone/tests/testSearch.py | ||
A news/139.bugfix | ||
M plone/app/querystring/querybuilder.py | ||
M plone/app/querystring/tests/testQueryBuilder.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' | ||
b'diff --git a/news/139.bugfix b/news/139.bugfix\nnew file mode 100644\nindex 0000000..ec4772e\n--- /dev/null\n+++ b/news/139.bugfix\n@@ -0,0 +1,2 @@\n+Handle parenthesis inside quotes\n+[erral]\ndiff --git a/plone/app/querystring/querybuilder.py b/plone/app/querystring/querybuilder.py\nindex d9ef15b..bd8978f 100644\n--- a/plone/app/querystring/querybuilder.py\n+++ b/plone/app/querystring/querybuilder.py\n@@ -44,10 +44,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@@ -66,7 +67,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/plone/app/querystring/tests/testQueryBuilder.py b/plone/app/querystring/tests/testQueryBuilder.py\nindex 4c39838..6a79bf0 100644\n--- a/plone/app/querystring/tests/testQueryBuilder.py\n+++ b/plone/app/querystring/tests/testQueryBuilder.py\n@@ -325,6 +325,80 @@ def testQueryBuilderCustomQueryDoNotOverrideValues(self):\n self.assertEqual(len(results), 1)\n self.assertEqual(results[0].Title(), "Collectionstestpage 2")\n \n+ def test_munge_search_term(self):\n+ from plone.app.querystring.querybuilder import _BAD_CHARS\n+ from plone.app.querystring.querybuilder import munge_search_term\n+\n+ search_term_tests = [\n+ (\n+ # search term\n+ "spam ham",\n+ "spam AND ham*",\n+ ),\n+ (\n+ # quoted term\n+ \'"spam ham"\',\n+ \'"spam ham"\',\n+ ),\n+ (\n+ # cleanup quoted terms\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",\n+ "Spam AND hAm*",\n+ ),\n+ (\n+ # mix quoting and unquoted\n+ \'let\\\'s eat some "ham and eggs " without spam \',\n+ \'"ham and eggs" AND let\\\'s AND eat AND some \' "AND without AND spam*",\n+ ),\n+ (\n+ \'test "Welcome" to "Plone" retest\',\n+ \'"Welcome" AND "Plone" AND test AND to AND retest*\',\n+ ),\n+ (\n+ # parentheses\n+ "spam (ham)",\n+ \'spam AND "("ham")"*\',\n+ ),\n+ (\n+ # special keywords\n+ "spam or not ham and eggs",\n+ \'spam AND "or" AND "not" AND ham AND "and" AND eggs*\',\n+ ),\n+ (\n+ # bad characters\n+ " ".join(_BAD_CHARS),\n+ "",\n+ ),\n+ (\n+ # weird input\n+ \'test ""Welcome" to "Plone"" retest\',\n+ \'"to" AND test AND WelcomePlone AND retest*\',\n+ ),\n+ ]\n+\n+ for _in, _out in search_term_tests:\n+ self.assertEqual(munge_search_term(_in), _out)\n+\n \n class TestQuerybuilderResultTypes(unittest.TestCase):\n layer = TEST_PROFILE_PLONEAPPQUERYSTRING_INTEGRATION_TESTING\n' | ||
|