- commit
- 6534f18fc158bb70229480c704f7c68f6521dd25
- parent
- 6a5b8f5bbbb150ce3b6bf68236f5c540b2242ce9
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2015-05-08 13:38
easier api to set value on multidict
Diffstat
| M | cctool.py | 9 | ++++++++- |
1 files changed, 8 insertions, 1 deletions
diff --git a/cctool.py b/cctool.py
@@ -137,9 +137,16 @@ class MultiDict(OrderedDict): 137 137 else: 138 138 raise KeyError(key) 139 139 -1 140 def append(self, key, values): -1 141 """Add a list of values.""" -1 142 for value in values: -1 143 if value not in self[key]: -1 144 self[key] = self[key] + [value] -1 145 140 146 def update(self, other): -1 147 """Update this MultiDict with the contentes of another one.""" 141 148 for key in other:142 -1 self[key] = list(set(self[key] + other[key]))-1 149 self.append(key, other[key]) 143 150 144 151 145 152 def merged(data, key):