[Zope-CVS] CVS: Products/Sessions - SessionDataManager.py:1.4

Matthew T. Kromer matt@zope.com
Tue, 6 Nov 2001 10:52:28 -0500


Update of /cvs-repository/Products/Sessions
In directory cvs.zope.org:/tmp/cvs-serv15118

Modified Files:
	SessionDataManager.py 
Log Message:
Updated traversal hook to shut up on failures after a few have been logged.


=== Products/Sessions/SessionDataManager.py 1.3 => 1.4 ===
         self._requestSessionName = requestSessionName
         self._sessionDataManager = sdm
+        self._v_errors=0
 
     def __call__(self, container, request):
         sdm = self._sessionDataManager.__of__(container)
         # Yank our session & stuff into request
         try:
             session = sdm.getSessionData()
+            self._v_errors = 0
         except:
-            LOG('Session Tracking', WARNING, 'Session automatic traversal '
-                'failed to get session data', error=sys.exc_info())
+            errors = getattr(self,"_v_errors", 0)
+            if errors < 4:
+                LOG('Session Tracking', WARNING, 'Session automatic traversal '
+                    'failed to get session data', error=sys.exc_info())
+            if errors == 3:
+                LOG('Session Tracking', WARNING, 'Suppressing further '
+                    'automatic session failure error messages on this thread')
+            self._v_errors = errors + 1
             return    # Throw our hands up but dont fail 
         if self._requestSessionName is not None:
             request[self._requestSessionName] = session