diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 85cdd44..b310184 100644
a
|
b
|
class SortedDict(dict):
|
77 | 77 | for key, value in self.iteritems()]) |
78 | 78 | |
79 | 79 | def __setitem__(self, key, value): |
80 | | super(SortedDict, self).__setitem__(key, value) |
81 | | if key not in self.keyOrder: |
| 80 | if key not in self: |
82 | 81 | self.keyOrder.append(key) |
| 82 | super(SortedDict, self).__setitem__(key, value) |
83 | 83 | |
84 | 84 | def __delitem__(self, key): |
85 | 85 | super(SortedDict, self).__delitem__(key) |
86 | 86 | self.keyOrder.remove(key) |
87 | 87 | |
88 | 88 | def __iter__(self): |
89 | | for k in self.keyOrder: |
90 | | yield k |
| 89 | return iter(self.keyOrder) |
91 | 90 | |
92 | 91 | def pop(self, k, *args): |
93 | 92 | result = super(SortedDict, self).pop(k, *args) |
… |
… |
class SortedDict(dict):
|
108 | 107 | |
109 | 108 | def iteritems(self): |
110 | 109 | for key in self.keyOrder: |
111 | | yield key, super(SortedDict, self).__getitem__(key) |
| 110 | yield key, self[key] |
112 | 111 | |
113 | 112 | def keys(self): |
114 | 113 | return self.keyOrder[:] |
… |
… |
class SortedDict(dict):
|
117 | 116 | return iter(self.keyOrder) |
118 | 117 | |
119 | 118 | def values(self): |
120 | | return map(super(SortedDict, self).__getitem__, self.keyOrder) |
| 119 | return map(self.__getitem__, self.keyOrder) |
121 | 120 | |
122 | 121 | def itervalues(self): |
123 | 122 | for key in self.keyOrder: |
124 | | yield super(SortedDict, self).__getitem__(key) |
| 123 | yield self[key] |
125 | 124 | |
126 | 125 | def update(self, dict_): |
127 | | for k, v in dict_.items(): |
128 | | self.__setitem__(k, v) |
| 126 | for k, v in dict_.iteritems(): |
| 127 | self[k] = v |
129 | 128 | |
130 | 129 | def setdefault(self, key, default): |
131 | | if key not in self.keyOrder: |
| 130 | if key not in self: |
132 | 131 | self.keyOrder.append(key) |
133 | 132 | return super(SortedDict, self).setdefault(key, default) |
134 | 133 | |
… |
… |
class MultiValueDict(dict):
|
222 | 221 | dict.__setitem__(result, copy.deepcopy(key, memo), |
223 | 222 | copy.deepcopy(value, memo)) |
224 | 223 | return result |
225 | | |
| 224 | |
226 | 225 | def __getstate__(self): |
227 | 226 | obj_dict = self.__dict__.copy() |
228 | 227 | obj_dict['_data'] = dict([(k, self.getlist(k)) for k in self]) |
229 | 228 | return obj_dict |
230 | | |
| 229 | |
231 | 230 | def __setstate__(self, obj_dict): |
232 | 231 | data = obj_dict.pop('_data', {}) |
233 | 232 | for k, v in data.items(): |
234 | 233 | self.setlist(k, v) |
235 | 234 | self.__dict__.update(obj_dict) |
236 | | |
| 235 | |
237 | 236 | def get(self, key, default=None): |
238 | 237 | """ |
239 | 238 | Returns the last data value for the passed key. If key doesn't exist |
… |
… |
class MultiValueDict(dict):
|
301 | 300 | def values(self): |
302 | 301 | """Returns a list of the last value on every key list.""" |
303 | 302 | return [self[key] for key in self.keys()] |
304 | | |
| 303 | |
305 | 304 | def itervalues(self): |
306 | 305 | """Yield the last value on every key list.""" |
307 | 306 | for key in self.iterkeys(): |
308 | 307 | yield self[key] |
309 | | |
| 308 | |
310 | 309 | def copy(self): |
311 | 310 | """Returns a copy of this object.""" |
312 | 311 | return self.__deepcopy__() |