diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-09-05 21:40:20 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-09-05 21:40:20 -0400 |
commit | 25efdfbabeee733247a6d9cd06156b2597f65146 (patch) | |
tree | 68d6015e2db4311f7742b7140aee6b730fdea054 /cmd2.py | |
parent | 5d5675bac5a8d431fbae1e12daf9b27ca4edfe91 (diff) | |
download | cmd2-git-25efdfbabeee733247a6d9cd06156b2597f65146.tar.gz |
Improved poutput() so that it can print an integer zero and other falsy things
The poutput() function has been ruggedized so that it has a better conditional check so that it will actually print
things which are "falsy" but are still convertible to a string.
A few unit tests have been added specifically for the poutput function.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -585,7 +585,7 @@ class Cmd(cmd.Cmd): :param msg: str - message to print to current stdout - anyting convertible to a str with '{}'.format() is OK :param end: str - string appended after the end of the message if not already present, default a newline """ - if msg: + if msg is not None and msg != '': try: msg_str = '{}'.format(msg) self.stdout.write(msg_str) |