[Zope3-checkins] CVS: Zope3/src/zope/app/services - error.py:1.3
Jim Fulton
jim at zope.com
Sun Sep 21 13:32:50 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/services
In directory cvs.zope.org:/tmp/cvs-serv14693/src/zope/app/services
Modified Files:
error.py
Log Message:
Changed the display of user info to be a bit more tolerant of
non-string user data.
No-longer use context wrappers.
=== Zope3/src/zope/app/services/error.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/services/error.py:1.2 Tue Aug 12 17:26:26 2003
+++ Zope3/src/zope/app/services/error.py Sun Sep 21 13:32:49 2003
@@ -25,11 +25,11 @@
from zope.app.interfaces.services.error import IErrorReportingService
from zope.app.interfaces.services.error import ILocalErrorReportingService
from zope.app.interfaces.services.service import ISimpleService
-from zope.context import ContextMethod
from zope.exceptions.exceptionformatter import format_exception
from zope.interface import implements
import logging
import time
+from zope.app.container.contained import Contained
#Restrict the rate at which errors are sent to the Event Log
_rate_restrict_pool = {}
@@ -48,7 +48,7 @@
cleanup_lock = allocate_lock()
-class ErrorReportingService(Persistent):
+class ErrorReportingService(Persistent, Contained):
"""Error Reporting Service
"""
implements(IErrorReportingService,
@@ -109,11 +109,11 @@
login = request.user.getLogin()
else:
login = 'unauthenticated'
- username = ', '.join((login,
+ username = ', '.join(map(str, (login,
request.user.getId(),
request.user.getTitle(),
request.user.getDescription()
- ))
+ )))
# When there's an unauthorized access, request.user is
# not set, so we get an AttributeError
# XXX is this right? Surely request.user should be set!
@@ -165,7 +165,6 @@
self._do_copy_to_zlog(now, strtype, str(url), info)
finally:
info = None
- raising = ContextMethod(raising)
def _do_copy_to_zlog(self, now, strtype, url, info):
# XXX info is unused; logging.exception() will call sys.exc_info()
@@ -187,7 +186,6 @@
'copy_to_zlog': self.copy_to_zlog,
'ignored_exceptions': self._ignored_exceptions,
}
- getProperties = ContextMethod(getProperties)
def setProperties(self, keep_entries, copy_to_zlog=0,
ignored_exceptions=()):
@@ -199,7 +197,7 @@
self._ignored_exceptions = tuple(
filter(None, map(str, ignored_exceptions))
)
- setProperties = ContextMethod(setProperties)
+
def getLogEntries(self):
"""Returns the entries in the log, most recent first.
@@ -208,7 +206,6 @@
res = [entry.copy() for entry in self._getLog()]
res.reverse()
return res
- getLogEntries = ContextMethod(getLogEntries)
def getLogEntryById(self, id):
"""Returns the specified log entry.
@@ -218,7 +215,6 @@
if entry['id'] == id:
return entry.copy()
return None
- getLogEntryById = ContextMethod(getLogEntryById)
class RootErrorReportingService(ErrorReportingService):
rootId = 'root'
More information about the Zope3-Checkins
mailing list