summaryrefslogtreecommitdiff
path: root/django/utils/datastructures.py
diff options
context:
space:
mode:
authorGary Wilson Jr <gary.wilson@gmail.com>2007-10-14 04:17:02 +0000
committerGary Wilson Jr <gary.wilson@gmail.com>2007-10-14 04:17:02 +0000
commit78d557bf024db83f41c9650c58700efd24172821 (patch)
tree01f058a34e724fb755d16a35e94f5022bbd950f7 /django/utils/datastructures.py
parenta3d015fad09e0376484b0e7c4b00f07243ee3af6 (diff)
downloaddjango-78d557bf024db83f41c9650c58700efd24172821.tar.gz
Fixed #5744 -- Allowed SortedDict contructor to be passed a list of tuples to match the interface of dict, thanks Thomas Güttler.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6506 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r--django/utils/datastructures.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 2f3c9bb568..d750f098f0 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -54,7 +54,10 @@ class SortedDict(dict):
def __init__(self, data=None):
if data is None: data = {}
dict.__init__(self, data)
- self.keyOrder = data.keys()
+ if isinstance(data, dict):
+ self.keyOrder = data.keys()
+ else:
+ self.keyOrder=[key for key, value in data]
def __setitem__(self, key, value):
dict.__setitem__(self, key, value)