Implemented LazyI18nString.__bool__ to return False on empty strings

This commit is contained in:
Raphael Michel
2016-03-22 18:03:44 +01:00
parent 842b058efd
commit 9fb3ccbde8

View File

@@ -40,6 +40,9 @@ class LazyI18nString:
"""
return self.localize(translation.get_language())
def __bool__(self):
return bool(len(self.data)) and any(self.data.values())
def localize(self, lng):
if self.data is None:
return ""