[Zope-Checkins] CVS: Zope/lib/python/Products/SiteErrorLog - SiteErrorLog.py:1.8
Casey Duncan
casey@zope.com
Tue, 25 Jun 2002 16:52:57 -0400
Update of /cvs-repository/Zope/lib/python/Products/SiteErrorLog
In directory cvs.zope.org:/tmp/cvs-serv21847/lib/python/Products/SiteErrorLog
Modified Files:
SiteErrorLog.py
Log Message:
Added ability for site error log to return the url to the log entry and pass it to the standard_error_message to make a link from it.
=== Zope/lib/python/Products/SiteErrorLog/SiteErrorLog.py 1.7 => 1.8 ===
Called by SimpleItem's exception handler.
+ Returns the url to view the error log entry
"""
try:
now = time.time()
@@ -163,11 +164,12 @@
strv = '<unprintable %s object>' % str(type(info[1]).__name__)
log = self._getLog()
+ entry_id = str(now) + str(random()) # Low chance of collision
log.append({
'type': strtype,
'value': strv,
'time': now,
- 'id': str(now) + str(random()), # Low chance of collision
+ 'id': entry_id,
'tb_text': tb_text,
'tb_html': tb_html,
'username': username,
@@ -181,6 +183,8 @@
del log[:-self.keep_entries]
finally:
cleanup_lock.release()
+
+ return '%s/showEntry?id=%s' % (self.absolute_url(), entry_id)
except:
LOG('SiteError', ERROR, 'Error while logging',
error=sys.exc_info())
@@ -257,7 +261,6 @@
if RESPONSE is not None:
RESPONSE.setHeader('Content-Type', 'text/plain')
return entry['tb_text']
-
Globals.InitializeClass(SiteErrorLog)