Commits

Robert Brewer committed 10ab3bb

Oops. Fixed #1082 better.

Comments (0)

Files changed (2)

cherrypy/lib/sessions.py

                     del self.locks[id]
                 except KeyError:
                     pass
+        
+        # added to remove obsolete lock objects
+        for id in list(self.locks):
+            if id not in self.cache:
+                self.locks.pop(id, None)
     
     def _exists(self):
         return self.id in self.cache
     
     def release_lock(self):
         """Release the lock on the currently-loaded session data."""
-        lock = self.locks.pop(self.id, None)
-        if lock:
-            lock.release()
+        self.locks[self.id].release()
         self.locked = False
     
     def __len__(self):

cherrypy/test/test_session.py

         # before_finalize (save) and on_end (close). So the session
         # code has to survive calling save/close without init.
         self.getPage('/restricted', self.cookies, method='POST')
-        self.assertErrorPage(405, response_codes[405])
+        self.assertErrorPage(405, response_codes[405][1])
     
     def test_6_regenerate(self):
         self.getPage('/testStr')
             # before_finalize (save) and on_end (close). So the session
             # code has to survive calling save/close without init.
             self.getPage('/restricted', self.cookies, method='POST')
-            self.assertErrorPage(405, response_codes[405])
+            self.assertErrorPage(405, response_codes[405][1])
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.