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

Shane Hathaway shane@cvs.zope.org
Wed, 21 Aug 2002 10:23:25 -0400


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

Modified Files:
	SiteErrorLog.py 
Log Message:
- Made the list of ignored exceptions configurable through the web.

- Show the most recent log entry first.


=== Zope/lib/python/Products/SiteErrorLog/SiteErrorLog.py 1.10 => 1.11 ===
--- Zope/lib/python/Products/SiteErrorLog/SiteErrorLog.py:1.10	Wed Aug 14 18:25:11 2002
+++ Zope/lib/python/Products/SiteErrorLog/SiteErrorLog.py	Wed Aug 21 10:23:24 2002
@@ -203,8 +203,11 @@
 
     security.declareProtected(use_error_logging, 'getProperties')
     def getProperties(self):
-        return {'keep_entries': self.keep_entries,
-                'copy_to_zlog': self.copy_to_zlog}
+        return {
+            'keep_entries': self.keep_entries,
+            'copy_to_zlog': self.copy_to_zlog,
+            'ignored_exceptions': self._ignored_exceptions,
+            }
 
     security.declareProtected(log_to_event_log, 'checkEventLogPermission')
     def checkEventLogPermission(self):
@@ -214,7 +217,8 @@
         return 1
 
     security.declareProtected(use_error_logging, 'setProperties')
-    def setProperties(self, keep_entries, copy_to_zlog=0, RESPONSE=None):
+    def setProperties(self, keep_entries, copy_to_zlog=0,
+                      ignored_exceptions=(), RESPONSE=None):
         """Sets the properties of this site error log.
         """
         copy_to_zlog = not not copy_to_zlog
@@ -223,6 +227,8 @@
             self.checkEventLogPermission()
         self.keep_entries = int(keep_entries)
         self.copy_to_zlog = copy_to_zlog
+        self._ignored_exceptions = tuple(
+            filter(None, map(str, ignored_exceptions)))
         if RESPONSE is not None:
             RESPONSE.redirect(
                 '%s/manage_main?manage_tabs_message=Changed+properties.' %
@@ -230,12 +236,14 @@
 
     security.declareProtected(use_error_logging, 'getLogEntries')
     def getLogEntries(self):
-        """Returns the entries in the log.
+        """Returns the entries in the log, most recent first.
 
         Makes a copy to prevent changes.
         """
         # List incomprehension ;-)
-        return [entry.copy() for entry in self._getLog()]
+        res = [entry.copy() for entry in self._getLog()]
+        res.reverse()
+        return res
 
     security.declareProtected(use_error_logging, 'getLogEntryById')
     def getLogEntryById(self, id):