summaryrefslogtreecommitdiff
path: root/blessings
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2013-11-04 21:22:44 -0800
committerjquast <contact@jeffquast.com>2013-11-04 21:22:44 -0800
commitb24c3737b3733ca5cc07a7ca201c9703407c210e (patch)
treecba512f9463644698c98781c11c90a4a606853b6 /blessings
parent536396a69c7e6c2f36e4961e6ab67d78444e14de (diff)
downloadblessings-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.
Diffstat (limited to 'blessings')
-rw-r--r--blessings/__init__.py7
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?