Commit ac9d6bc9 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Remove the XXX about 'handle' prefix in handler classes, prefix true private

methods with two underscores instead of one.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1161 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1059ac65
...@@ -55,10 +55,7 @@ class EventHandler(object): ...@@ -55,10 +55,7 @@ class EventHandler(object):
self.packet_dispatch_table = self.initPacketDispatchTable() self.packet_dispatch_table = self.initPacketDispatchTable()
self.error_dispatch_table = self.initErrorDispatchTable() self.error_dispatch_table = self.initErrorDispatchTable()
# XXX: there is an inconsistency between connection* and handle* names. As def __packetMalformed(self, conn, packet, message='', *args):
# we are in an hander, I think that's redondant to prefix with 'handle'
def _packetMalformed(self, conn, packet, message='', *args):
"""Called when a packet is malformed.""" """Called when a packet is malformed."""
args = (conn.getAddress()[0], conn.getAddress()[1], message) args = (conn.getAddress()[0], conn.getAddress()[1], message)
if packet is None: if packet is None:
...@@ -74,7 +71,7 @@ class EventHandler(object): ...@@ -74,7 +71,7 @@ class EventHandler(object):
conn.abort() conn.abort()
self.peerBroken(conn) self.peerBroken(conn)
def _unexpectedPacket(self, conn, packet, message=None): def __unexpectedPacket(self, conn, packet, message=None):
"""Handle an unexpected packet.""" """Handle an unexpected packet."""
if message is None: if message is None:
message = 'unexpected packet type %s in %s' % (packet.getType(), message = 'unexpected packet type %s in %s' % (packet.getType(),
...@@ -97,9 +94,9 @@ class EventHandler(object): ...@@ -97,9 +94,9 @@ class EventHandler(object):
args = packet.decode() or () args = packet.decode() or ()
method(conn, packet, *args) method(conn, packet, *args)
except UnexpectedPacketError, e: except UnexpectedPacketError, e:
self._unexpectedPacket(conn, packet, *e.args) self.__unexpectedPacket(conn, packet, *e.args)
except PacketMalformedError, e: except PacketMalformedError, e:
self._packetMalformed(conn, packet, *e.args) self.__packetMalformed(conn, packet, *e.args)
except BrokenNodeDisallowedError: except BrokenNodeDisallowedError:
answer_packet = protocol.brokenNodeDisallowedError('go away') answer_packet = protocol.brokenNodeDisallowedError('go away')
conn.answer(answer_packet, packet.getId()) conn.answer(answer_packet, packet.getId())
......
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