Ticket #8278: 8278.querydict.diff
File 8278.querydict.diff, 2.3 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()])194 d = dict([(f(k), [f(v) for v in values]) for k, values in other_dict.lists()]) 195 195 MultiValueDict.update(self, d) 196 196 197 197 def pop(self, key, *args): -
django/django/utils/datastructures.py
293 293 else: 294 294 try: 295 295 for key, value in other_dict.items(): 296 self.setlistdefault(key, []).append(value) 296 if isinstance(value, list): 297 self.setlistdefault(key, []).extend(value) 298 else: 299 self.setlistdefault(key, []).append(value) 297 300 except TypeError: 298 301 raise ValueError, "MultiValueDict.update() takes either a MultiValueDict or dictionary" 299 302 for key, value in kwargs.iteritems(): -
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 # Merging 2 QueryDict's with same keys and multiple values # 433 ############################################################# 434 435 >>> x = QueryDict('a=1&a=2') 436 >>> y = QueryDict('a=3&a=4') 437 >>> x._mutable = True 438 >>> x.update(y) 439 >>> x._mutable=False 440 >>> x 441 <QueryDict: {u'a': [u'1', u'2', u'3', u'4']}> 442 430 443 """ 431 444 432 445 from django.http import QueryDict, HttpResponse