mirror of https://github.com/django/django.git
Fixed #6627 -- Made dict.clear() work for SortedDicts.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7140 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
dd2afd7105
commit
54546f23f0
|
@ -155,6 +155,10 @@ class SortedDict(dict):
|
||||||
"""
|
"""
|
||||||
return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in self.items()])
|
return '{%s}' % ', '.join(['%r: %r' % (k, v) for k, v in self.items()])
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
super(SortedDict, self).clear()
|
||||||
|
self.keyOrder = []
|
||||||
|
|
||||||
class MultiValueDictKeyError(KeyError):
|
class MultiValueDictKeyError(KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,12 @@ Init from sequence of tuples
|
||||||
>>> print repr(d)
|
>>> print repr(d)
|
||||||
{1: 'one', 0: 'zero', 2: 'two'}
|
{1: 'one', 0: 'zero', 2: 'two'}
|
||||||
|
|
||||||
|
>>> d.clear()
|
||||||
|
>>> d
|
||||||
|
{}
|
||||||
|
>>> d.keyOrder
|
||||||
|
[]
|
||||||
|
|
||||||
### DotExpandedDict ############################################################
|
### DotExpandedDict ############################################################
|
||||||
|
|
||||||
>>> d = DotExpandedDict({'person.1.firstname': ['Simon'], 'person.1.lastname': ['Willison'], 'person.2.firstname': ['Adrian'], 'person.2.lastname': ['Holovaty']})
|
>>> d = DotExpandedDict({'person.1.firstname': ['Simon'], 'person.1.lastname': ['Willison'], 'person.2.firstname': ['Adrian'], 'person.2.lastname': ['Holovaty']})
|
||||||
|
|
Loading…
Reference in New Issue