-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/master Date: 2023-12-11T16:01:24+01:00 Author: Jens W. Klein (jensens) <[email protected]> Commit: plone/Products.CMFPlone@7e50e84 mark get_production_resource_directory deprectated Files changed: A news/3887.bugfix M Products/CMFPlone/resources/utils.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2023-12-14T12:25:33+01:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> Commit: plone/Products.CMFPlone@5f8f65a Merge pull request #3887 from plone/deprecate-get_production_resource_directory mark get_production_resource_directory deprectated Files changed: A news/3887.bugfix M Products/CMFPlone/resources/utils.py
- Loading branch information
1 parent
75266da
commit 50b685d
Showing
1 changed file
with
17 additions
and
34 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,51 +1,34 @@ | ||
Repository: plone.app.querystring | ||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2023-11-29T13:33:12+01:00 | ||
Author: Mikel Larreategi (erral) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.querystring/commit/c66c920642887141ec6c9ac2fcf87f363d12de01 | ||
Date: 2023-12-11T16:01:24+01:00 | ||
Author: Jens W. Klein (jensens) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/7e50e843fb13097ddcf55bfc4d0220e9955c658e | ||
|
||
handle parenthesis inside quotes | ||
mark get_production_resource_directory deprectated | ||
|
||
Files changed: | ||
A news/139.bugfix | ||
M plone/app/querystring/querybuilder.py | ||
M plone/app/querystring/tests/testQueryBuilder.py | ||
A news/3887.bugfix | ||
M Products/CMFPlone/resources/utils.py | ||
|
||
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' | ||
b'diff --git a/Products/CMFPlone/resources/utils.py b/Products/CMFPlone/resources/utils.py\nindex e72f9553fe..a0632ec8dc 100644\n--- a/Products/CMFPlone/resources/utils.py\n+++ b/Products/CMFPlone/resources/utils.py\n@@ -8,6 +8,7 @@\n from Products.CMFCore.utils import getToolByName\n from zExceptions import NotFound\n from zope.component import queryUtility\n+from zope.deprecation import deprecate\n \n import logging\n \n@@ -16,7 +17,12 @@\n logger = logging.getLogger(__name__)\n \n \n+@deprecate(\n+ "get_production_resource_directory is deprecated and will be removed in Plone 7. "\n+)\n def get_production_resource_directory():\n+ # this function is not used in Plone 6.1 anymore, but we keep it for\n+ # backwards compatibility until Plone 7\n persistent_directory = queryUtility(IResourceDirectory, name="persistent")\n if persistent_directory is None:\n return ""\ndiff --git a/news/3887.bugfix b/news/3887.bugfix\nnew file mode 100644\nindex 0000000000..3cfbd5fff6\n--- /dev/null\n+++ b/news/3887.bugfix\n@@ -0,0 +1,2 @@\n+Deprecate `get_production_resource_directory` since it is not used anywhere in core.\n+[@jensens]\n\\ No newline at end of file\n' | ||
|
||
Repository: plone.app.querystring | ||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/master | ||
Date: 2023-11-29T13:35:51+01:00 | ||
Author: Mikel Larreategi (erral) <[email protected]> | ||
Commit: https://github.com/plone/plone.app.querystring/commit/5b2909f448b6da18ddb5751acc6e2dffef4cbedd | ||
Date: 2023-12-14T12:25:33+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/5f8f65a89b787c33a90c05eee80eeb86e31d56a2 | ||
|
||
run black | ||
Merge pull request #3887 from plone/deprecate-get_production_resource_directory | ||
|
||
Files changed: | ||
M plone/app/querystring/tests/testQueryBuilder.py | ||
|
||
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: plone.app.querystring | ||
|
||
|
||
Branch: refs/heads/master | ||
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 #140 from plone/erral-issue-139 | ||
|
||
handle parenthesis inside quotes | ||
mark get_production_resource_directory deprectated | ||
|
||
Files changed: | ||
A news/139.bugfix | ||
M plone/app/querystring/querybuilder.py | ||
M plone/app/querystring/tests/testQueryBuilder.py | ||
A news/3887.bugfix | ||
M Products/CMFPlone/resources/utils.py | ||
|
||
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' | ||
b'diff --git a/Products/CMFPlone/resources/utils.py b/Products/CMFPlone/resources/utils.py\nindex e72f9553fe..a0632ec8dc 100644\n--- a/Products/CMFPlone/resources/utils.py\n+++ b/Products/CMFPlone/resources/utils.py\n@@ -8,6 +8,7 @@\n from Products.CMFCore.utils import getToolByName\n from zExceptions import NotFound\n from zope.component import queryUtility\n+from zope.deprecation import deprecate\n \n import logging\n \n@@ -16,7 +17,12 @@\n logger = logging.getLogger(__name__)\n \n \n+@deprecate(\n+ "get_production_resource_directory is deprecated and will be removed in Plone 7. "\n+)\n def get_production_resource_directory():\n+ # this function is not used in Plone 6.1 anymore, but we keep it for\n+ # backwards compatibility until Plone 7\n persistent_directory = queryUtility(IResourceDirectory, name="persistent")\n if persistent_directory is None:\n return ""\ndiff --git a/news/3887.bugfix b/news/3887.bugfix\nnew file mode 100644\nindex 0000000000..3cfbd5fff6\n--- /dev/null\n+++ b/news/3887.bugfix\n@@ -0,0 +1,2 @@\n+Deprecate `get_production_resource_directory` since it is not used anywhere in core.\n+[@jensens]\n\\ No newline at end of file\n' | ||
|