[Zope-Checkins] CVS: Zope/lib/python/Products/SiteErrorLog - SiteErrorLog.py:1.5

Toby Dickenson tdickenson@geminidataloggers.com
Mon, 15 Apr 2002 06:52:30 -0400


Update of /cvs-repository/Zope/lib/python/Products/SiteErrorLog
In directory cvs.zope.org:/tmp/cvs-serv5060

Modified Files:
	SiteErrorLog.py 
Log Message:
added _ignored_exceptions; 'Unauthorized' no longer appears in the error log

=== Zope/lib/python/Products/SiteErrorLog/SiteErrorLog.py 1.4 => 1.5 ===
         return log
 
+    # Exceptions that happen all the time, so we dont need
+    # to log them. Eventually this should be configured
+    # through-the-web.
+    _ignored_exceptions = ( 'Unauthorized', )
+
     security.declarePrivate('raising')
     def raising(self, info):
         """Log an exception.
@@ -109,6 +114,10 @@
                 tb_text = None
                 tb_html = None
 
+                strtype = str(getattr(info[0], '__name__', info[0]))
+                if strtype in self._ignored_exceptions:
+                    return
+                                
                 if not isinstance(info[2], StringType) and not isinstance(
                     info[2], UnicodeType):
                     tb_text = ''.join(
@@ -137,7 +146,7 @@
 
                 log = self._getLog()
                 log.append({
-                    'type': str(getattr(info[0], '__name__', info[0])),
+                    'type': strtype,
                     'value': strv,
                     'time': now,
                     'id': str(now) + str(random()), # Low chance of collision