Repository: ultrabug/py3status

Issue:
safe_format: '0' are not displayed
`py3.safe_format` doesn't show '0' and it doesn't show the placeholder either. So, it seems it sees the placeholder has a value, but somehow messes up displaying the value.

Here is a test module to showcase the issue:

``` python
# -*- coding: utf-8 -*-

class Py3status:
    def __init__(self):
        pass

    def test_safe_format(self, i3s_output_list, i3s_config):
        return {
            'cached_until': self.py3.CACHE_FOREVER,
            'full_text': self.py3.safe_format("zero: '{zero:d}'", {'zero': 0})
        }

if __name__ == "__main__":
    """
    Run module in test mode.
    """
    from py3status.module_test import module_test
    module_test(Py3status)
```



Discussion:

Resolving patch:
diff --git a/py3status/formatter.py b/py3status/formatter.py
--- a/py3status/formatter.py
+++ b/py3status/formatter.py
@@ -204,7 +204,7 @@ def set_param(param, value, key):
             """
             if self.python2 and isinstance(param, str):
                 param = param.decode('utf-8')
-            if param:
+            if param or param is 0:
                 value = value.format(**{key: param})
                 block.add(value)
                 block.mark_valid()
@@ -308,6 +308,7 @@ def set_param(param, value, key):
         'long_str': 'I am a long string though not too long',
         'python2_unicode': u'Björk',
         'python2_str': 'Björk',
+        'zero': 0,
     }
 
     composites = {
@@ -419,6 +420,67 @@ def module_property(self):
             'format': 'zero [one [two [three [{no}]]]]|Numbers',
             'expected': 'Numbers',
         },
+        # zero/False/None etc
+        {
+            'format': '{zero}',
+            'expected': '0',
+        },
+        {
+            'format': '[{zero}] hello',
+            'expected': '0 hello',
+        },
+        {
+            'format': '[{zero} ping] hello',
+            'expected': '0 ping hello',
+        },
+        {
+            'format': '{None}',
+            'expected': '',
+        },
+        {
+            'format': '[{None}] hello',
+            'expected': ' hello',
+        },
+        {
+            'format': '[{None} ping] hello',
+            'expected': ' hello',
+        },
+        {
+            'format': '{no}',
+            'expected': '',
+        },
+        {
+            'format': '[{no}] hello',
+            'expected': ' hello',
+        },
+        {
+            'format': '[{no} ping] hello',
+            'expected': ' hello',
+        },
+        {
+            'format': '{yes}',
+            'expected': 'True',
+        },
+        {
+            'format': '[{yes}] hello',
+            'expected': 'True hello',
+        },
+        {
+            'format': '[{yes} ping] hello',
+            'expected': 'True ping hello',
+        },
+        {
+            'format': '{empty}',
+            'expected': '',
+        },
+        {
+            'format': '[{empty}] hello',
+            'expected': ' hello',
+        },
+        {
+            'format': '[{empty} ping] hello',
+            'expected': ' hello',
+        },
         # python 2 unicode
         {
             'format': 'Hello {python2_unicode}! ☂',


Test patch: