Skip to content

Commit

Permalink
msgen: Use python str() to format types in __str__
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Stringer <joestringernz@gmail.com>
  • Loading branch information
joestringer committed Dec 19, 2012
1 parent c1e9f92 commit acd8af7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions rflib/ipc/RFProtocol.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion rflib/ipc/msgen.py
Expand Up @@ -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()
Expand Down

0 comments on commit acd8af7

Please sign in to comment.