Loading django/http/__init__.py +7 −2 Original line number Diff line number Diff line Loading @@ -211,6 +211,11 @@ class QueryDict(MultiValueDict): def update(self, other_dict): self._assert_mutable() f = lambda s: str_to_unicode(s, self.encoding) if hasattr(other_dict, 'lists'): for key, valuelist in other_dict.lists(): for value in valuelist: MultiValueDict.update(self, {f(key): f(value)}) else: d = dict([(f(k), f(v)) for k, v in other_dict.items()]) MultiValueDict.update(self, d) Loading tests/regressiontests/httpwrappers/tests.py +8 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,14 @@ Traceback (most recent call last): ... UnicodeEncodeError: ..., HTTP response headers must be in US-ASCII format # # Regression test for #8278: QueryDict.update(QueryDict) # >>> x = QueryDict("a=1&a=2", mutable=True) >>> y = QueryDict("a=3&a=4") >>> x.update(y) >>> x.getlist('a') [u'1', u'2', u'3', u'4'] """ from django.http import QueryDict, HttpResponse Loading Loading
django/http/__init__.py +7 −2 Original line number Diff line number Diff line Loading @@ -211,6 +211,11 @@ class QueryDict(MultiValueDict): def update(self, other_dict): self._assert_mutable() f = lambda s: str_to_unicode(s, self.encoding) if hasattr(other_dict, 'lists'): for key, valuelist in other_dict.lists(): for value in valuelist: MultiValueDict.update(self, {f(key): f(value)}) else: d = dict([(f(k), f(v)) for k, v in other_dict.items()]) MultiValueDict.update(self, d) Loading
tests/regressiontests/httpwrappers/tests.py +8 −0 Original line number Diff line number Diff line Loading @@ -436,6 +436,14 @@ Traceback (most recent call last): ... UnicodeEncodeError: ..., HTTP response headers must be in US-ASCII format # # Regression test for #8278: QueryDict.update(QueryDict) # >>> x = QueryDict("a=1&a=2", mutable=True) >>> y = QueryDict("a=3&a=4") >>> x.update(y) >>> x.getlist('a') [u'1', u'2', u'3', u'4'] """ from django.http import QueryDict, HttpResponse Loading