[Zope-Checkins] SVN: Zope/trunk/ - The SiteErrorLog now allows you
to acknowledge exceptions.
Christian Theune
ct at gocept.com
Sun Aug 29 10:00:53 EDT 2004
Log message for revision 27328:
- The SiteErrorLog now allows you to acknowledge exceptions.
Changed:
U Zope/trunk/doc/CHANGES.txt
U Zope/trunk/lib/python/Products/SiteErrorLog/SiteErrorLog.py
U Zope/trunk/lib/python/Products/SiteErrorLog/__init__.py
U Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
U Zope/trunk/lib/python/Products/SiteErrorLog/www/main.pt
A Zope/trunk/lib/python/Products/SiteErrorLog/www/ok.gif
-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt 2004-08-29 13:57:11 UTC (rev 27327)
+++ Zope/trunk/doc/CHANGES.txt 2004-08-29 14:00:53 UTC (rev 27328)
@@ -26,6 +26,11 @@
Features added
+ - The SiteErrorLog allows you to acknowledge (or delete) exceptions,
+ so you can reduce or clear the list without restarting your
+ Zope server. Additionally the SiteErrorLog is covered by unit tests
+ now.
+
- UI improvement for the ZCatalog. The "catalog contents" allow
you to filter the cataloged objects by path now.
Modified: Zope/trunk/lib/python/Products/SiteErrorLog/SiteErrorLog.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteErrorLog/SiteErrorLog.py 2004-08-29 13:57:11 UTC (rev 27327)
+++ Zope/trunk/lib/python/Products/SiteErrorLog/SiteErrorLog.py 2004-08-29 14:00:53 UTC (rev 27328)
@@ -120,6 +120,22 @@
# Exceptions that happen all the time, so we dont need
# to log them. Eventually this should be configured
# through-the-web.
+ security.declareProtected(use_error_logging, 'forgetEntry')
+ def forgetEntry(self, id, REQUEST=None):
+ """Removes an entry from the error log."""
+ log = self._getLog()
+ cleanup_lock.acquire()
+ i=0
+ for entry in log:
+ if entry['id'] == id:
+ del log[i]
+ i += 1
+ cleanup_lock.release()
+ if REQUEST is not None:
+ return Globals.MessageDialog(title='Entry removed',
+ message='Error log entry was removed.',
+ action='./manage_main',)
+
_ignored_exceptions = ( 'Unauthorized', 'NotFound', 'Redirect' )
security.declarePrivate('raising')
Modified: Zope/trunk/lib/python/Products/SiteErrorLog/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteErrorLog/__init__.py 2004-08-29 13:57:11 UTC (rev 27327)
+++ Zope/trunk/lib/python/Products/SiteErrorLog/__init__.py 2004-08-29 14:00:53 UTC (rev 27328)
@@ -17,7 +17,12 @@
"""
import SiteErrorLog
+from ImageFile import ImageFile
+misc_={
+ 'ok.gif': ImageFile('www/ok.gif', globals()),
+}
+
def initialize(context):
context.registerClass(SiteErrorLog.SiteErrorLog,
constructors=(SiteErrorLog.manage_addErrorLog,),
Modified: Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py
===================================================================
--- Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py 2004-08-29 13:57:11 UTC (rev 27327)
+++ Zope/trunk/lib/python/Products/SiteErrorLog/tests/testSiteErrorLog.py 2004-08-29 14:00:53 UTC (rev 27328)
@@ -61,6 +61,27 @@
# Now look at the SiteErrorLog, it has one more log entry
self.assertEquals(len(sel_ob.getLogEntries()), previous_log_length+1)
+ def testForgetException(self):
+ elog = self.app.error_log
+
+
+ # Create a predictable error
+ try:
+ raise AttributeError, "DummyAttribute"
+ except AttributeError:
+ info = sys.exc_info()
+ elog.raising(info)
+ previous_log_length = len(elog.getLogEntries())
+
+ entries = elog.getLogEntries()
+ self.assertEquals(entries[0]['value'], "DummyAttribute")
+
+ # Kick it
+ elog.forgetEntry(entries[0]['id'])
+
+ # Really gone?
+ self.assertEquals(len(elog.getLogEntries()), previous_log_length-1)
+
def testIgnoredException(self):
# Grab the Site Error Log
sel_ob = self.app.error_log
Modified: Zope/trunk/lib/python/Products/SiteErrorLog/www/main.pt
===================================================================
--- Zope/trunk/lib/python/Products/SiteErrorLog/www/main.pt 2004-08-29 13:57:11 UTC (rev 27327)
+++ Zope/trunk/lib/python/Products/SiteErrorLog/www/main.pt 2004-08-29 14:00:53 UTC (rev 27328)
@@ -69,6 +69,7 @@
<th align="left">Time</th>
<th align="left">Username (User Id)</th>
<th align="left">Exception</th>
+ <th></th>
</tr>
<tr tal:repeat="entry entries">
<td valign="top" nowrap="nowrap">
@@ -88,6 +89,7 @@
Application object has no attribute "zzope"</span>
</a>
</td>
+ <td><a href="#" tal:attributes="href string:${here/absolute_url}/forgetEntry?id=${entry/id}"><img title="Forget this entry" src="/misc_/SiteErrorLog/ok.gif" border="0"></a></td>
</tr>
</table>
Added: Zope/trunk/lib/python/Products/SiteErrorLog/www/ok.gif
===================================================================
(Binary files differ)
Property changes on: Zope/trunk/lib/python/Products/SiteErrorLog/www/ok.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the Zope-Checkins
mailing list