{{{
>>> 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.
* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/26707#comment:1>
* has_patch: 0 => 1
* component: Utilities => HTTP handling
Comment:
https://github.com/django/django/pull/6715
--
Ticket URL: <https://code.djangoproject.com/ticket/26707#comment:2>
* needs_better_patch: 0 => 1
Comment:
Noted in the PR that I think the current implementation needs more error
handling, so I'm marking 'patch needs improvement'. Totally willing to be
corrected on this!
--
Ticket URL: <https://code.djangoproject.com/ticket/26707#comment:3>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/26707#comment:4>
* stage: Accepted => Ready for checkin
Comment:
Looks good, pending a few cosmetic updates noted on the PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/26707#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"5ebebd1159b4bacfce1999e41831081679b6f35a" 5ebebd11]:
{{{
#!CommitTicketReference repository=""
revision="5ebebd1159b4bacfce1999e41831081679b6f35a"
Fixed #26707 -- Added QueryDict.fromkeys()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26707#comment:6>