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:
parent
ce9aca5823
commit
9ed4217a57
|
@ -121,9 +121,9 @@ class QueryDict(MultiValueDict):
|
||||||
self._assert_mutable()
|
self._assert_mutable()
|
||||||
MultiValueDict.update(self, other_dict)
|
MultiValueDict.update(self, other_dict)
|
||||||
|
|
||||||
def pop(self, key):
|
def pop(self, key, *args):
|
||||||
self._assert_mutable()
|
self._assert_mutable()
|
||||||
return MultiValueDict.pop(self, key)
|
return MultiValueDict.pop(self, key, *args)
|
||||||
|
|
||||||
def popitem(self):
|
def popitem(self):
|
||||||
self._assert_mutable()
|
self._assert_mutable()
|
||||||
|
|
|
@ -166,6 +166,9 @@ True
|
||||||
>>> q.pop('foo')
|
>>> q.pop('foo')
|
||||||
['bar', 'baz', 'another', 'hello']
|
['bar', 'baz', 'another', 'hello']
|
||||||
|
|
||||||
|
>>> q.pop('foo', 'not there')
|
||||||
|
'not there'
|
||||||
|
|
||||||
>>> q.get('foo', 'not there')
|
>>> q.get('foo', 'not there')
|
||||||
'not there'
|
'not there'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue