Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
View
7 django/utils/datastructures.py
@@ -99,6 +99,13 @@ def copy(self):
obj.keyOrder = self.keyOrder
return obj
+ def __repr__(self):
+ """
+ Replaces the normal dict.__repr__ with a version that returns the keys
+ in their sorted order.
+ """
+ return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in self.items()])
+
class MultiValueDictKeyError(KeyError):
pass
View
2  tests/regressiontests/datastructures/tests.py
@@ -52,6 +52,8 @@
'not one'
>>> d.keys() == d.copy().keys()
True
+>>> print repr(d)
+{'one': 'not one', 'two': 'two', 'three': 'three'}
### DotExpandedDict ############################################################
Please sign in to comment.
Something went wrong with that request. Please try again.