Fixed #4337 -- Added pop() method to QueryDict. Thanks, Gary Wilson.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5289 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-05-19 18:34:00 +00:00
parent ce9aca5823
commit 9ed4217a57
2 changed files with 5 additions and 2 deletions

View File

@ -121,9 +121,9 @@ class QueryDict(MultiValueDict):
self._assert_mutable()
MultiValueDict.update(self, other_dict)
def pop(self, key):
def pop(self, key, *args):
self._assert_mutable()
return MultiValueDict.pop(self, key)
return MultiValueDict.pop(self, key, *args)
def popitem(self):
self._assert_mutable()

View File

@ -166,6 +166,9 @@ True
>>> q.pop('foo')
['bar', 'baz', 'another', 'hello']
>>> q.pop('foo', 'not there')
'not there'
>>> q.get('foo', 'not there')
'not there'