#23460: Allow a literal `%s` to be passed through extra select
-------------------------------------+-------------------------------------
     Reporter:  mattrobenolt         |                    Owner:  nobody
         Type:  Uncategorized        |                   Status:  new
    Component:  Database layer       |                  Version:  1.7
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:
     Keywords:  queryset             |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by mattrobenolt:

Old description:

> Right now, if you try and do something like this:
>
> {{{
> Foo.objects.extra(select={'foo': "'%%s"'})
> }}}
>
> or
>
> {{{
> Foo.objects.extra(select={'foo': '"%s"'})
> }}}
>
> it blows up because it tries to convert the %s into a parameter
>
> It's expected to allow %%s as an escape sequence.
>
> See: https://github.com/django/django/pull/3209 for patch.

New description:

 Right now, if you try and do something like this:

 {{{
 Foo.objects.extra(select={'foo': "'%%s"'})
 }}}

 or

 {{{
 Foo.objects.extra(select={'foo': '"%s"'})
 }}}

 Ultimately `add_extra` raises a `StopIteration` while iterating over
 `param_iter` since there aren't actually any arguments to format.

 It's expected to allow %%s as an escape sequence.

 See: https://github.com/django/django/pull/3209 for patch.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/23460#comment:3>
Django <https://code.djangoproject.com/>
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 post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/070.66fbe51ba75ccdd78285e047cb9e0170%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to