#29166: in lookup doesn't work with lists in a When clause
-------------------------------------+-------------------------------------
     Reporter:  Matthew Pava         |                    Owner:  felixxm
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  2.0
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:  fixed
     Keywords:  lookup in            |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Дилян Палаузов):

 {{{
 diff --git a/django/db/models/expressions.py
 b/django/db/models/expressions.py
 +        return hash((path, output_field) + args + tuple([
 +            (key, tuple(value)) if isinstance(value, list) else (key,
 value)
 +            for key, value in kwargs.items()
 +        ]))
 }}}

 Aren't here the {{{[}}} and {{{]}}} superflous, as the parameter of both
 {{{tuple()}}} and {{{[]}}} have to be iterable, and this the type of the
 inlined {{{for}}}:
 {{{
 >>> tuple([(x,y) for x, y in {'a': 1, 'b':2, 'c':3}.items()])
 (('a', 1), ('b', 2), ('c', 3))
 >>> tuple((x,y) for x, y in {'a': 1, 'b':2, 'c':3}.items())
 (('a', 1), ('b', 2), ('c', 3))
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29166#comment:7>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.5b9e7207ba2b0de0c5df779b0e99103b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to