summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2017-09-05 21:40:20 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2017-09-05 21:40:20 -0400
commit25efdfbabeee733247a6d9cd06156b2597f65146 (patch)
tree68d6015e2db4311f7742b7140aee6b730fdea054 /cmd2.py
parent5d5675bac5a8d431fbae1e12daf9b27ca4edfe91 (diff)
downloadcmd2-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-xcmd2.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd2.py b/cmd2.py
index dc34df6b..87fb3aad 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -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)