summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2010-10-27 20:39:20 +0000
committerAlex Gaynor <alex.gaynor@gmail.com>2010-10-27 20:39:20 +0000
commitc6f90f00535ab55d36fe687305d4aebdad197001 (patch)
treeba5d0ee909cfff56f187afc972202c1832c40bf5 /django/utils
parent3d69b217901ba4ea094b7999ba931ad1c20a61e7 (diff)
Fixed MultiValueDict's copy implementation to be consistant with all other copies.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14366 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/datastructures.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 30ce28d38d..7425ea2ce2 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -1,6 +1,6 @@
from types import GeneratorType
-from django.utils.copycompat import deepcopy
+from django.utils.copycompat import copy, deepcopy
class MergeDict(object):
@@ -263,7 +263,10 @@ class MultiValueDict(dict):
super(MultiValueDict, self).__setitem__(key, [value])
def __copy__(self):
- return self.__class__(super(MultiValueDict, self).items())
+ return self.__class__([
+ (k, v[:])
+ for k, v in self.lists()
+ ])
def __deepcopy__(self, memo=None):
import django.utils.copycompat as copy
@@ -361,8 +364,8 @@ class MultiValueDict(dict):
yield self[key]
def copy(self):
- """Returns a copy of this object."""
- return self.__deepcopy__()
+ """Returns a shallow copy of this object."""
+ return copy(self)
def update(self, *args, **kwargs):
"""
@@ -491,4 +494,3 @@ class DictWrapper(dict):
if use_func:
return self.func(value)
return value
-