Fixed #24621 -- Fixed and documented SessionBase.pop's second argument
Changed SessionBase.pop's second argument to explicitly be default=None rather than *args since _session is always a dict. Thanks gabor for the report and Tim Graham for the review.
This commit is contained in:
parent
b295fcd19c
commit
872eb26f54
|
@ -58,9 +58,9 @@ class SessionBase(object):
|
||||||
def get(self, key, default=None):
|
def get(self, key, default=None):
|
||||||
return self._session.get(key, default)
|
return self._session.get(key, default)
|
||||||
|
|
||||||
def pop(self, key, *args):
|
def pop(self, key, default=None):
|
||||||
self.modified = self.modified or key in self._session
|
self.modified = self.modified or key in self._session
|
||||||
return self._session.pop(key, *args)
|
return self._session.pop(key, default)
|
||||||
|
|
||||||
def setdefault(self, key, value):
|
def setdefault(self, key, value):
|
||||||
if key in self._session:
|
if key in self._session:
|
||||||
|
|
|
@ -205,9 +205,9 @@ You can edit it multiple times.
|
||||||
|
|
||||||
Example: ``fav_color = request.session.get('fav_color', 'red')``
|
Example: ``fav_color = request.session.get('fav_color', 'red')``
|
||||||
|
|
||||||
.. method:: pop(key)
|
.. method:: pop(key, default=None)
|
||||||
|
|
||||||
Example: ``fav_color = request.session.pop('fav_color')``
|
Example: ``fav_color = request.session.pop('fav_color', 'blue')``
|
||||||
|
|
||||||
.. method:: keys()
|
.. method:: keys()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue