Ticket #6465: 6465-1.diff
File 6465-1.diff, 1.3 KB (added by , 17 years ago) |
---|
-
django/utils/datastructures.py
25 25 26 26 def getlist(self, key): 27 27 for dict_ in self.dicts: 28 try:28 if key in dict_.keys(): 29 29 return dict_.getlist(key) 30 except KeyError: 31 pass 32 raise KeyError 30 return [] 33 31 34 32 def items(self): 35 33 item_list = [] -
tests/regressiontests/datastructures/tests.py
20 20 >>> md2['chris'] 21 21 'cool' 22 22 23 MergeDict can merge MultiValueDicts 24 >>> multi1 = MultiValueDict({'key1': ['value1'], 'key2': ['value2', 'value3']}) 25 >>> multi2 = MultiValueDict({'key3': ['value4'], 'key4': ['value5', 'value6']}) 26 >>> mm = MergeDict(multi1, multi2) 27 >>> mm.getlist('key2') 28 ['value2', 'value3'] 29 >>> mm.getlist('key4') 30 ['value5', 'value6'] 31 >>> mm.getlist('undefined') 32 [] 33 23 34 ### MultiValueDict ########################################################## 24 35 25 36 >>> d = MultiValueDict({'name': ['Adrian', 'Simon'], 'position': ['Developer']})