diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-04-15 15:37:21 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-04-15 15:37:21 +0100 |
commit | 5cf3c6ea230fab510fb44aa113066a5eb69183f8 (patch) | |
tree | 1f102d1d6b8d3a763c4b9f0e9621ced83615ab17 | |
parent | 11a5adc06df5001d589ddfc80717e0e9586e0b3a (diff) | |
download | python-ttystatus-5cf3c6ea230fab510fb44aa113066a5eb69183f8.tar.gz |
Fix Integer() to not render in update
-rw-r--r-- | ttystatus/integer.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ttystatus/integer.py b/ttystatus/integer.py index b02a79f..1b27126 100644 --- a/ttystatus/integer.py +++ b/ttystatus/integer.py @@ -23,14 +23,14 @@ class Integer(ttystatus.Widget): def __init__(self, key): self._key = key - self.value = '#' + self.value = None def __str__(self): - return self.value + try: + return str(int(self.value)) + except (TypeError, ValueError): + return '#' def update(self, master): - try: - self.value = str(int(master[self._key])) - except ValueError: - self.value = '#' + self.value = master[self._key] |