#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
 +        return hash((path, output_field) + args + tuple([
 +            (key, tuple(value)) if isinstance(value, list) else (key,
 +            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 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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to