Commits

Robert Brewer  committed c973f35

Fix for #642 (session.pop).

  • Participants
  • Parent commits ec4e509

Comments (0)

Files changed (1)

File cherrypy/lib/sessions.py

             self.function(*self.args, **self.kwargs)
 
 
+missing = object()
+
 class Session(object):
     """A CherryPy dict-like Session object (one per request).
     
         if not self.loaded: self.load()
         del self._data[key]
     
+    def pop(self, key, default=missing):
+        if not self.loaded: self.load()
+        if default is missing:
+            return self._data.pop(key)
+        else:
+            return self._data.pop(key, default)
+    
     def __contains__(self, key):
         if not self.loaded: self.load()
         return key in self._data