[Checkins] SVN: zc.zservertracelog/trunk/ Slight refactoring to allow alternative tracelog implementations.
jim
cvs-admin at zope.org
Tue Mar 20 15:45:35 UTC 2012
Log message for revision 124646:
Slight refactoring to allow alternative tracelog implementations.
Changed:
U zc.zservertracelog/trunk/CHANGES.txt
U zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py
-=-
Modified: zc.zservertracelog/trunk/CHANGES.txt
===================================================================
--- zc.zservertracelog/trunk/CHANGES.txt 2012-03-20 15:26:03 UTC (rev 124645)
+++ zc.zservertracelog/trunk/CHANGES.txt 2012-03-20 15:45:31 UTC (rev 124646)
@@ -1,11 +1,14 @@
Changes
=======
-1.3.1 (2012-03-20)
+1.3.2 (2012-03-20)
------------------
- Slight refactoring to allow alternative tracelog implementations.
+1.3.1 (2012-03-20)
+------------------
+
- Fix KeyError: 'ZODB.interfaces.IConnection' on requests that do not have
a ZODB connection in annotations (e.g. GET /++etc++process).
Modified: zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py
===================================================================
--- zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py 2012-03-20 15:26:03 UTC (rev 124645)
+++ zc.zservertracelog/trunk/src/zc/zservertracelog/tracelog.py 2012-03-20 15:45:31 UTC (rev 124646)
@@ -61,13 +61,11 @@
class TraceLog(object):
zope.interface.implements(zc.zservertracelog.interfaces.ITraceLog)
- transfer_counts = None
-
def __init__(self, channel_id):
self.channel_id = channel_id
- def log(self, msg=None):
- _log(self.channel_id, '-', msg)
+ def log(self, msg=None, code='-'):
+ _log(self.channel_id, code, msg)
class Parser(zope.server.http.httprequestparser.HTTPRequestParser):
@@ -173,7 +171,7 @@
tl = request.get('zc.zservertracelog.interfaces.ITraceLog')
if tl is None:
return
- if tl.transfer_counts is None:
+ if getattr(tl, 'transfer_counts', None) is None:
connection = request.annotations.get('ZODB.interfaces.IConnection')
# Not all requests have a ZODB connection; consider /++etc++process
if connection is None:
@@ -188,7 +186,7 @@
tl = request.get('zc.zservertracelog.interfaces.ITraceLog')
if tl is None:
return
- initial_counts = tl.transfer_counts
+ initial_counts = getattr(tl, 'transfer_counts', None)
if not initial_counts:
return
tl.transfer_counts = None # Reset in case of conflict
@@ -205,4 +203,4 @@
if r or w:
data.append((name, r, w))
msg = ' '.join(' '.join(map(str, r)) for r in sorted(data))
- _log(tl.channel_id, 'D', msg.strip())
+ tl.log(msg.strip(), 'D')
More information about the checkins
mailing list