summaryrefslogtreecommitdiff
path: root/django/utils/datastructures.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-25 04:00:15 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-08-25 04:00:15 +0000
commit62b39322f30fc274de033441d652a0c6714f93d7 (patch)
tree0450d85f91cdd022010d66d2a17d9aba67a2dd92 /django/utils/datastructures.py
parentd62cfce213e9393407846477a1a599f847be8603 (diff)
downloaddjango-62b39322f30fc274de033441d652a0c6714f93d7.tar.gz
Fixed #7496 -- It's now possible to pickle SortedDicts with pickle protocol 2
(used in caching). Thanks, John Huddleston. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8531 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r--django/utils/datastructures.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 818731ba04..5837c3d236 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -54,6 +54,11 @@ class SortedDict(dict):
"""
A dictionary that keeps its keys in the order in which they're inserted.
"""
+ def __new__(cls, *args, **kwargs):
+ instance = super(SortedDict, cls).__new__(cls, *args, **kwargs)
+ instance.keyOrder = []
+ return instance
+
def __init__(self, data=None):
if data is None:
data = {}