Commit bda44a22 authored by Vincent Pelletier's avatar Vincent Pelletier

Factorise a bit lookups in HandlerSwitcher.emit .

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2005 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bd07d6c4
......@@ -88,12 +88,14 @@ class HandlerSwitcher(object):
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]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment