diff options
author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 05:14:13 +0000 |
---|---|---|
committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 05:14:13 +0000 |
commit | 9ae873fcd83221a17d41f31f2ac32e37f439ae7b (patch) | |
tree | 3290d2f88485ab5f104574c18df798dce603c35f /django/utils/datastructures.py | |
parent | 62353e8fe74b37d60841696846f985e45e8b03bf (diff) | |
download | django-9ae873fcd83221a17d41f31f2ac32e37f439ae7b.tar.gz |
Fixed #10184: QueryDicts with multiple values can now be safely pickled. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10240 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r-- | django/utils/datastructures.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index 5837c3d236..d0cd9085dd 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -222,7 +222,18 @@ class MultiValueDict(dict): dict.__setitem__(result, copy.deepcopy(key, memo), copy.deepcopy(value, memo)) return result - + + def __getstate__(self): + obj_dict = self.__dict__.copy() + obj_dict['_data'] = dict([(k, self.getlist(k)) for k in self]) + return obj_dict + + def __setstate__(self, obj_dict): + data = obj_dict.pop('_data', {}) + for k, v in data.items(): + self.setlist(k, v) + self.__dict__.update(obj_dict) + def get(self, key, default=None): """ Returns the last data value for the passed key. If key doesn't exist |