Signed-off-by: WATANABE Fumitaka <[email protected]>
---
ryu/lib/packet/packet.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/ryu/lib/packet/packet.py b/ryu/lib/packet/packet.py
index d6aeed7..fb69e7c 100644
--- a/ryu/lib/packet/packet.py
+++ b/ryu/lib/packet/packet.py
@@ -125,3 +125,12 @@ 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):
+ buf = ''
+ for protocol in self.protocols:
+ if buf != '':
+ buf += ', '
+ buf += repr(protocol) # repr() to escape binaries
+ return buf
+ __repr__ = __str__ # note: str(list) uses __repr__ for elements
-- 1.7.10.4
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel