summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--ttystatus/string.py2
-rw-r--r--ttystatus/string_tests.py4
3 files changed, 10 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 58e8280..821c26f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
NEWS file for ttystatus
=======================
+Version 0.15, released UNRELEASED
+---------------------------------
+
+* Bugfix: the String widget now handles non-string values.
+
Version 0.14, released 2011-08-31
---------------------------------
diff --git a/ttystatus/string.py b/ttystatus/string.py
index 1dc3023..32a76ea 100644
--- a/ttystatus/string.py
+++ b/ttystatus/string.py
@@ -27,7 +27,7 @@ class String(ttystatus.Widget):
self.value = ''
def format(self):
- return self.value
+ return str(self.value)
def update(self, master, width):
self.value = master[self._key]
diff --git a/ttystatus/string_tests.py b/ttystatus/string_tests.py
index b0e17dd..39f480a 100644
--- a/ttystatus/string_tests.py
+++ b/ttystatus/string_tests.py
@@ -30,3 +30,7 @@ class StringTests(unittest.TestCase):
def test_updates(self):
self.s.update({'foo': 'bar'}, 999)
self.assertEqual(str(self.s), 'bar')
+
+ def test_handles_non_string_value(self):
+ self.s.update({'foo': 123}, 999)
+ self.assertEqual(str(self.s), '123')