[Neo-report] r2669 jm - /trunk/neo/lib/protocol.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 17 18:37:30 CET 2011
Author: jm
Date: Thu Mar 17 18:37:30 2011
New Revision: 2669
Log:
Fix lib.protocol not registering properly when a packet should be ignored when closed
This fixes several random failures in unit tests.
Modified:
trunk/neo/lib/protocol.py
Modified: trunk/neo/lib/protocol.py
==============================================================================
--- trunk/neo/lib/protocol.py [iso-8859-1] (original)
+++ trunk/neo/lib/protocol.py [iso-8859-1] Thu Mar 17 18:37:30 2011
@@ -1339,12 +1339,13 @@ class NotifyReady(Packet):
pass
StaticRegistry = {}
-def register(code, request, answer=None, ignore_when_closed=None):
+def register(code, request, ignore_when_closed=None):
""" Register a packet in the packet registry """
# register the request
assert code not in StaticRegistry, "Duplicate request packet code"
request._code = code
StaticRegistry[code] = request
+ answer = request._answer
if ignore_when_closed is None:
# By default, on a closed connection:
# - request: ignore
@@ -1352,7 +1353,7 @@ def register(code, request, answer=None,
# - nofitication: keep
ignore_when_closed = answer is not None
request._ignore_when_closed = ignore_when_closed
- if request._answer in (Error, None):
+ if answer in (Error, None):
return request
# build a class for the answer
answer = ClassType('Answer%s' % (request.__name__, ), (Packet, ), {})
More information about the Neo-report
mailing list