summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-03-09 05:34:42 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-03-09 05:34:42 +0000
commit22178d692a651be21fa9347502babe1bd17aabf2 (patch)
treeeb64f70accc5ea56903181b3522428294ffb6ec0 /django/utils
parentfcd119bfb18b20e81457f845b826733eee9c0cd0 (diff)
Fixed #3678 -- Implemented SortedDict.copy().
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/datastructures.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 94ab76c483..e924e4edbc 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -92,6 +92,13 @@ class SortedDict(dict):
"Returns the value of the item at the given zero-based index."
return self[self.keyOrder[index]]
+ def copy(self):
+ "Returns a copy of this object."
+ # This way of initialising the copy means it works for subclasses, too.
+ obj = self.__class__(self)
+ obj.keyOrder = self.keyOrder
+ return obj
+
class MultiValueDictKeyError(KeyError):
pass