kopia lustrzana https://github.com/wagtail/wagtail
Fix parsing of queries with multiple filters that contain quotes
rodzic
cc0f2d7c4c
commit
96b94d01d9
|
@ -69,6 +69,7 @@ Changelog
|
|||
* Fix: Use the correct color for placeholders in rich text fields (Thibaud Colas)
|
||||
* Fix: Prevent obstructing the outline around rich text fields (Thibaud Colas)
|
||||
* Fix: Page editor dropdowns now use indigo backgrounds like elsewhere in the admin interface (Thibaud Colas)
|
||||
* Fix: Allow parsing of multiple key/value pairs from string in `wagtail.search.utils.parse_query_string` (Beniamin Bucur)
|
||||
* Docs: Add custom permissions section to permissions documentation page (Dan Hayden)
|
||||
* Docs: Add documentation for how to get started with contributing translations for the Wagtail admin (Ogunbanjo Oluwadamilare)
|
||||
* Docs: Officially recommend `fnm` over `nvm` in development documentation (LB (Ben) Johnston)
|
||||
|
|
|
@ -683,6 +683,7 @@ Contributors
|
|||
* Alex Simpson
|
||||
* GLEF1X
|
||||
* Nick Lee
|
||||
* Beniamin Bucur
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
@ -106,6 +106,7 @@ This feature was developed by Matt Westcott, and sponsored by [YouGov](https://y
|
|||
* Use the correct color for placeholders in rich text fields (Thibaud Colas)
|
||||
* Prevent obstructing the outline around rich text fields (Thibaud Colas)
|
||||
* Page editor dropdowns now use indigo backgrounds like elsewhere in the admin interface (Thibaud Colas)
|
||||
* Allow parsing of multiple key/value pairs from string in `wagtail.search.utils.parse_query_string` (Beniamin Bucur)
|
||||
|
||||
### Documentation
|
||||
|
||||
|
|
|
@ -248,6 +248,14 @@ class TestSeparateFiltersFromQuery(SimpleTestCase):
|
|||
self.assertDictEqual(filters, {"author": "foo bar", "bar": "beer"})
|
||||
self.assertEqual(query, "hello world")
|
||||
|
||||
def test_two_filters_with_quotation_marks_and_query(self):
|
||||
filters, query = separate_filters_from_query(
|
||||
'author:"foo bar" hello world bar:"two beers"'
|
||||
)
|
||||
|
||||
self.assertDictEqual(filters, {"author": "foo bar", "bar": "two beers"})
|
||||
self.assertEqual(query, "hello world")
|
||||
|
||||
|
||||
class TestParseQueryString(SimpleTestCase):
|
||||
def test_simple_query(self):
|
||||
|
|
|
@ -82,7 +82,7 @@ def normalise_query_string(query_string):
|
|||
|
||||
|
||||
def separate_filters_from_query(query_string):
|
||||
filters_regexp = r'(\w+):(\w+|".+")'
|
||||
filters_regexp = r'(\w+):(\w+|"[^"]+")'
|
||||
|
||||
filters = {}
|
||||
for match_object in re.finditer(filters_regexp, query_string):
|
||||
|
|
Ładowanie…
Reference in New Issue