Re: [Django] #32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term with three quotes

2021-04-13 Thread Django
#32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term
with three quotes
---+--
 Reporter:  Dlis   |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  3.2
 Severity:  Normal |   Resolution:
 Keywords:  admin, search  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by Dlis):

 If somebody has such the problem, here is our temporary fix which was
 added to our internal basic ModelAdmin:

 {{{
 def get_search_results(self, request, queryset, search_term):
 parts = search_term.split()
 try:
 for part in text.smart_split(search_term):
 text.unescape_string_literal(part)
 except ValueError:
 parts = map(lambda t: str(t).strip('"').strip("'"), parts)
 return super().get_search_results(request, queryset, ' '.join(parts))
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.412784acc345fe1e75649f6429aaf479%40djangoproject.com.


Re: [Django] #32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term with three quotes

2021-04-13 Thread Django
#32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term
with three quotes
---+--
 Reporter:  Dlis   |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  3.2
 Severity:  Normal |   Resolution:
 Keywords:  admin, search  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by Dlis):

 The bag can be reproduced by the following way:

 {{{
 from django.utils.text import smart_split
 from django.utils.text import unescape_string_literal

 search_term = 'Foo "Bar "Baz"'
 parts = list(smart_split(search_term))
 unescape_string_literal(parts[1])
 }}}

 Result is {{{ValueError: Not a string literal: '"Bar "Baz'}}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.49f657694f879e97be493eebc3f146a5%40djangoproject.com.


Re: [Django] #32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term with three quotes

2021-04-13 Thread Django
#32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term
with three quotes
---+--
 Reporter:  Dlis   |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  3.2
 Severity:  Normal |   Resolution:
 Keywords:  admin, search  | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Description changed by Dlis:

Old description:

> django.contrib.admin.ModelAdmin.search_fields now allows searching
> against quoted phrases with spaces but unfortunately search crashes for a
> search term like **Foo "Foo "Baz"** (with three quotes, some company
> names match such the pattern)

New description:

 django.contrib.admin.ModelAdmin.search_fields now allows searching against
 quoted phrases with spaces but unfortunately search crashes for a search
 term like **Foo "Bar "Baz"** (with three quotes, some company names match
 such the pattern)

--

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.37e0368650c046f44dcfa04800e1d39e%40djangoproject.com.


[Django] #32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term with three quotes

2021-04-13 Thread Django
#32649: django.contrib.admin.ModelAdmin.search_fields crashes for a search term
with three quotes
-+---
   Reporter:  Dlis   |  Owner:  nobody
   Type:  Bug| Status:  new
  Component:  contrib.admin  |Version:  3.2
   Severity:  Normal |   Keywords:  admin, search
   Triage Stage:  Unreviewed |  Has patch:  0
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+---
 django.contrib.admin.ModelAdmin.search_fields now allows searching against
 quoted phrases with spaces but unfortunately search crashes for a search
 term like **Foo "Foo "Baz"** (with three quotes, some company names match
 such the pattern)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/047.9317906bd2eab77ee894926768d2139d%40djangoproject.com.