diff options
author | jquast <contact@jeffquast.com> | 2013-11-04 21:22:44 -0800 |
---|---|---|
committer | jquast <contact@jeffquast.com> | 2013-11-04 21:22:44 -0800 |
commit | b24c3737b3733ca5cc07a7ca201c9703407c210e (patch) | |
tree | cba512f9463644698c98781c11c90a4a606853b6 | |
parent | 536396a69c7e6c2f36e4961e6ab67d78444e14de (diff) | |
download | blessings-b24c3737b3733ca5cc07a7ca201c9703407c210e.tar.gz |
turtles all the way down for NullCallableString()
allow term.color(5)('shmoo') to succeed for terminals where stream is
not a tty.
-rw-r--r-- | blessings/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/blessings/__init__.py b/blessings/__init__.py index b135e01..7df617d 100644 --- a/blessings/__init__.py +++ b/blessings/__init__.py @@ -518,7 +518,12 @@ class NullCallableString(unicode): # determine which of 2 special-purpose classes, # NullParametrizableString or NullFormattingString, to return, and # retire this one. - return u'' + # As a NullCallableString, even when provided with a parameter, + # such as t.color(5), we must also still be callable, fe: + # >>> t.color(5)('shmoo') + # is actually simplified result of NullCallable()(), so + # turtles all the way down: we return another instance. + return NullCallableString() return args[0] # Should we force even strs in Python 2.x to be # unicodes? No. How would I know what encoding to use # to convert it? |