From acd8af79b47e9abe36d6007910bc007725608e87 Mon Sep 17 00:00:00 2001 From: Joe Stringer Date: Fri, 7 Dec 2012 14:15:02 +1300 Subject: [PATCH] msgen: Use python str() to format types in __str__ Signed-off-by: Joe Stringer --- rflib/ipc/RFProtocol.py | 4 ++-- rflib/ipc/msgen.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rflib/ipc/RFProtocol.py b/rflib/ipc/RFProtocol.py index a36a36ec..76562d3e 100644 --- a/rflib/ipc/RFProtocol.py +++ b/rflib/ipc/RFProtocol.py @@ -312,7 +312,7 @@ def __str__(self): s += " dst_port: " + str(self.get_dst_port()) + "\n" s += " src_hwaddress: " + str(self.get_src_hwaddress()) + "\n" s += " dst_hwaddress: " + str(self.get_dst_hwaddress()) + "\n" - s += " is_removal: " + bool(self.get_is_removal()) + "\n" + s += " is_removal: " + str(self.get_is_removal()) + "\n" return s class FlowMod(MongoIPCMessage): @@ -433,7 +433,7 @@ def __str__(self): s += " dst_port: " + str(self.get_dst_port()) + "\n" s += " src_hwaddress: " + str(self.get_src_hwaddress()) + "\n" s += " dst_hwaddress: " + str(self.get_dst_hwaddress()) + "\n" - s += " is_removal: " + bool(self.get_is_removal()) + "\n" + s += " is_removal: " + str(self.get_is_removal()) + "\n" return s class DatapathPortRegister(MongoIPCMessage): diff --git a/rflib/ipc/msgen.py b/rflib/ipc/msgen.py index 292272c5..8cefb1c6 100644 --- a/rflib/ipc/msgen.py +++ b/rflib/ipc/msgen.py @@ -329,7 +329,7 @@ def genPy(messages, fname): g.addLine("s = \"{0}\\n\"".format(name)) for t, f in msg: value = "self.get_{0}()".format(f) - g.addLine("s += \" {0}: \" + {1} + \"\\n\"".format(f, pyExportType[t].format(value))) + g.addLine("s += \" {0}: \" + str({1}) + \"\\n\"".format(f, value)) g.addLine("return s") g.decreaseIndent() g.decreaseIndent()