#26707: QueryDict.fromkeys fails in mysterious ways
----------------------------+----------------------------
     Reporter:  wimglenn    |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Utilities   |    Version:  master
     Severity:  Normal      |   Keywords:  http querydict
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+----------------------------
 In django.http.QueryDict, we currently have the following weird behaviour
 and misleading error messages:

 {{{
 >>> QueryDict.fromkeys(['k1', 'k2'])
 AttributeError: This QueryDict instance is immutable
 }}}

 It is not possible to pass the mutable kwarg to the initialise in this
 way, either:

 {{{
 >>> QueryDict.fromkeys(['k1', 'k2'], mutable=True)
 TypeError: fromkeys() takes no keyword arguments
 }}}

 Django's querydict is-a dict, so the classmethod factory "fromkeys" should
 either
 a) work, or
 b) be explicitly disabled in the subclass, and documented as such

 The relevant section in the docs (
 https://docs.djangoproject.com/en/dev/ref/request-
 response/#django.http.QueryDict ) says that:

   > QueryDict implements all the standard dictionary methods because it’s
 a subclass of dictionary. Exceptions are outlined here: ...

 However, there is no mention about the fromkeys method.

--
Ticket URL: <https://code.djangoproject.com/ticket/26707>
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/051.0f0a1835ad76c1d2b7badff3398005bd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to