--- session.py.orig	2003-05-27 16:23:05.000000000 -0400
+++ session.py	2003-05-27 16:25:51.000000000 -0400
@@ -382,6 +382,10 @@
             # yet, eg. if someone tries to leave a session with no
             # interesting data.  That's not a big deal, so ignore it.
             pass
+        except TypeError:
+            # Happens if request.session.id is None and you are using dbm; for
+            # example, the Python shelve module
+            pass
         request.session = None
 
     def has_session_cookie (self, request, must_exist=0):
