summaryrefslogtreecommitdiff
path: root/django/utils/datastructures.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-11-29 20:09:54 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-11-29 20:09:54 +0000
commitcaa0523cb8afc19fbbe193b8488eed810dc35829 (patch)
treebcd0c76094408cd5227cb603096f180e616b7c2e /django/utils/datastructures.py
parent8f97d962389c52f95c3d5956c3ef754f2d39ea60 (diff)
Fixed #6050 -- Handled edge-case of duplicate keys being passed when
initialising SortedDict. Patch from Collin Grady and SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6751 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 ffdc73f922..ee156b11d0 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -60,7 +60,10 @@ class SortedDict(dict):
if isinstance(data, dict):
self.keyOrder = data.keys()
else:
- self.keyOrder = [key for key, value in data]
+ self.keyOrder = []
+ for key, value in data:
+ if key not in self.keyOrder:
+ self.keyOrder.append(key)
def __deepcopy__(self, memo):
from copy import deepcopy