From 9fb3ccbde8153c9524f6dff35875f240d2fe788b Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 22 Mar 2016 18:03:44 +0100 Subject: [PATCH] Implemented LazyI18nString.__bool__ to return False on empty strings --- src/pretix/base/i18n.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pretix/base/i18n.py b/src/pretix/base/i18n.py index b183a1d97..6343c6dc7 100644 --- a/src/pretix/base/i18n.py +++ b/src/pretix/base/i18n.py @@ -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 ""