From e0d82b9d375a1ce697b9d32ffb28271a0d1c4304 Mon Sep 17 00:00:00 2001 From: "watanabe.fumitaka" Date: Mon, 5 Aug 2013 13:07:39 +0900 Subject: packet lib to string: add __str__ to base Signed-off-by: WATANABE Fumitaka Signed-off-by: FUJITA Tomonori --- ryu/lib/packet/packet.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py index f80948a6..785a28be 100644 --- a/ryu/lib/packet/packet.py +++ b/ryu/lib/packet/packet.py @@ -127,3 +127,7 @@ class Packet(object): issubclass(protocol, packet_base.PacketBase)): return protocol in [p.__class__ for p in self.protocols] return protocol in self.protocols + + def __str__(self): + return ', '.join(repr(protocol) for protocol in self.protocols) + __repr__ = __str__ # note: str(list) uses __repr__ for elements -- cgit v1.2.3