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:
Malcolm Tredinnick 2008-02-21 21:27:44 +00:00
parent dd2afd7105
commit 54546f23f0
2 changed files with 10 additions and 0 deletions

View File

@ -155,6 +155,10 @@ class SortedDict(dict):
"""
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):
pass

View File

@ -101,6 +101,12 @@ Init from sequence of tuples
>>> print repr(d)
{1: 'one', 0: 'zero', 2: 'two'}
>>> d.clear()
>>> d
{}
>>> d.keyOrder
[]
### DotExpandedDict ############################################################
>>> d = DotExpandedDict({'person.1.firstname': ['Simon'], 'person.1.lastname': ['Willison'], 'person.2.firstname': ['Adrian'], 'person.2.lastname': ['Holovaty']})