Commit 6d63a03d authored by Grégory Wisniewski's avatar Grégory Wisniewski

Implement a simple __repr__ on Packet and Handler classes.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1863 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent a1979325
......@@ -29,6 +29,9 @@ class EventHandler(object):
self.packet_dispatch_table = self.__initPacketDispatchTable()
self.error_dispatch_table = self.__initErrorDispatchTable()
def __repr__(self):
return self.__class__.__name__
def _packetMalformed(self, conn, message='', *args):
"""Called when a packet is malformed."""
args = (conn.getAddress()[0], conn.getAddress()[1], message)
......
......@@ -273,6 +273,9 @@ class Packet(object):
def __len__(self):
return PACKET_HEADER_SIZE + len(self._body)
def __repr__(self):
return self.__class__.__name__
def __eq__(self, other):
""" Compare packets with their code instead of content """
if other is None:
......
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