Ticket #8278: 8278.querydict.2.diff
File 8278.querydict.2.diff, 1.7 KB (added by , 16 years ago) |
---|
-
django/django/http/__init__.py
191 191 def update(self, other_dict): 192 192 self._assert_mutable() 193 193 f = lambda s: str_to_unicode(s, self.encoding) 194 d = dict([(f(k), f(v)) for k, v in other_dict.items()]) 195 MultiValueDict.update(self, d) 194 try: 195 for key, _list in other_dict.lists(): 196 for value in _list: 197 MultiValueDict.update(self, { f(key): f(value) }) 198 except AttributeError: 199 d = dict([(f(k), f(v)) for k, v in other_dict.items()]) 200 MultiValueDict.update(self, d) 196 201 197 202 def pop(self, key, *args): 198 203 self._assert_mutable() -
django/tests/regressiontests/httpwrappers/tests.py
426 426 Traceback (most recent call last): 427 427 ... 428 428 UnicodeEncodeError: ..., HTTP response headers must be in US-ASCII format 429 429 430 431 432 ############################################################# 433 # Merging 2 QueryDict's with same keys and multiple values # 434 ############################################################# 435 436 >>> x = QueryDict('a=1&a=2', mutable=True) 437 >>> y = QueryDict('a=3&a=4') 438 >>> x.update(y) 439 >>> x 440 <QueryDict: {u'a': [u'1', u'2', u'3', u'4']}> 441 430 442 """ 431 443 432 444 from django.http import QueryDict, HttpResponse