Re: [Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-04-14 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
-+-
 Reporter:  kezabelle|Owner:
 Type:   |  alexandrinaw
  Cleanup/optimization   |   Status:  closed
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"99d40c6f658ead97f67d331eed9278805c8a4007" 99d40c6]:
 {{{
 #!CommitTicketReference repository=""
 revision="99d40c6f658ead97f67d331eed9278805c8a4007"
 Fixed #24277 -- Added exception when dict used in QuerySet filtering
 }}}

--
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 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/067.9f47673b6aa86237903d6f9bb948e0fe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-04-14 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
-+-
 Reporter:  kezabelle|Owner:
 Type:   |  alexandrinaw
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by alexandrinaw):

 * stage:  Accepted => Ready for checkin


--
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 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/067.12963fb1c796bbaf9b227145212b66cf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-04-14 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
-+-
 Reporter:  kezabelle|Owner:
 Type:   |  alexandrinaw
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by timgraham):

 * needs_better_patch:  0 => 1


Comment:

 Left minor comments for improvement.

--
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 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/067.cb2013d2f55ac91b732e828530c270d6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-04-13 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
-+-
 Reporter:  kezabelle|Owner:
 Type:   |  alexandrinaw
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by alexandrinaw):

 * has_patch:  0 => 1


--
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 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/067.88f1337cf3129089b8325d2fcb8c0f39%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-04-13 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
-+-
 Reporter:  kezabelle|Owner:
 Type:   |  alexandrinaw
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by alexandrinaw):

 * owner:  nnja => alexandrinaw
 * cc: alexandrinaw (added)


--
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 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/067.87816dac135315c22b7dd0becd44628e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-04-13 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
-+-
 Reporter:  kezabelle|Owner:  nnja
 Type:   |   Status:  assigned
  Cleanup/optimization   |
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by nnja):

 * cc: nnja (added)
 * owner:  nobody => nnja
 * status:  new => assigned


--
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 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/067.59d05081cef08d6b08e9ca5de52be6f8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-02-04 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
-+-
 Reporter:  kezabelle|Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Database layer   |  Version:  master
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by akaariai):

 * needs_better_patch:   => 0
 * stage:  Unreviewed => Accepted
 * needs_tests:   => 0
 * needs_docs:   => 0


Comment:

 Agreed that it would be better to error out in this case.

 Note that the behavior has been there forever (at least from 1.0 days, see
 
https://github.com/django/django/blob/stable/1.0.x/django/db/models/sql/query.py#L1155)

--
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 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/067.88844580f0dc9061d1b9519dc286a0dc%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #24277: Passing a dict with 2 keys to a queryset filter passes erroneously.

2015-02-04 Thread Django
#24277: Passing a dict with 2 keys to a queryset filter passes erroneously.
--+
 Reporter:  kezabelle |  Owner:  nobody
 Type:  Cleanup/optimization  | Status:  new
Component:  Database layer (models, ORM)  |Version:  master
 Severity:  Normal|   Keywords:
 Triage Stage:  Unreviewed|  Has patch:  0
Easy pickings:  0 |  UI/UX:  0
--+
 It's reasonably common to do this:
 {{{
 kws = {'first_name': 'test', 'is_superuser': False}
 get_user_model().objects.filter(**kws)
 }}}
 when building up a set of queryset filters, at least if you don't need to
 introduce ORs (via `Q()`).

 However, if you forget, or accidentally don't star-expand the dictionary:
 {{{
 get_user_model().objects.filter(kws)
 }}}
 You instead get back a queryset with the wrong SQL applied, specifically,
 above it yields `WHERE first_name = 'is_superuser'`, though that may be a
 function of the relative stableness of dicts on Python2.

 This is in contrast to if your `kws` dict contains 1, or 3+ keys, which
 correctly error loudly and let you know you screwed up, yielding either:
 {{{
 ValueError: need more than 1 value to unpack
 ValueError: too many values to unpack (expected 2)
 }}}
 Or if you're lucky, and the `get_prep_lookup` can figure out you've been
 silly:
 {{{
 # using kws = {'id': 1, 'is_superuser': False}
 ValueError: invalid literal for int() with base 10: 'is_superuser'
 }}}
 (This last is a relatively recent addition in master, as far as I can
 tell, having just pulled up to date from just after 1.8a I think)

 The issue itself stems from
 
[https://github.com/akaariai/django/blob/a7260199ad63cd07e4df85438cb283413978fad2/django/db/models/sql/query.py#L1119
 Query.build_filter], and the specific line which causes the problem I
 think would survive the changes being made in #24267.

--
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 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/052.ecc41ae52bdd760a3e2a6a8ee5476951%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.