[Neo-report] r2005 vincent - /trunk/neo/connection.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 22 16:37:53 CEST 2010
Author: vincent
Date: Thu Apr 22 16:37:53 2010
New Revision: 2005
Log:
Factorise a bit lookups in HandlerSwitcher.emit .
Modified:
trunk/neo/connection.py
Modified: trunk/neo/connection.py
==============================================================================
--- trunk/neo/connection.py [iso-8859-1] (original)
+++ trunk/neo/connection.py [iso-8859-1] Thu Apr 22 16:37:53 2010
@@ -88,12 +88,14 @@
def emit(self, request):
# register the request in the current handler
- assert len(self._pending) == 1 or self._pending[0][0]
- (request_dict, _) = self._pending[-1]
+ _pending = self._pending
+ assert len(_pending) == 1 or _pending[0][0]
+ (request_dict, _) = _pending[-1]
msg_id = request.getId()
- assert request.getAnswerClass() is not None, "Not a request"
+ answer_class = request.getAnswerClass()
+ assert answer_class is not None, "Not a request"
assert msg_id not in request_dict, "Packet id already expected"
- request_dict[msg_id] = request.getAnswerClass()
+ request_dict[msg_id] = answer_class
def handle(self, packet):
assert len(self._pending) == 1 or self._pending[0][0]
More information about the Neo-report
mailing list