[IMP] tools: fallback on empty translation

Avoid returning False if, for any reason, the return is falsy (False,
None,...)

Following the discussion in odoo/odoo#53254, the root cause was a call in the form
  _(foo)

where foo was equal False

While nothing else than a string should be the argument of _, it's
still technically possible to pass something else and get a bad return
value.
Fallback on empty string to be consistent.
This commit is contained in:
Martin Trigaux
2020-06-30 08:53:29 +00:00
parent 8add388db6
commit d12813f7ee
+1 -1
View File
@@ -487,7 +487,7 @@ class GettextAlias(object):
finally:
if cr and is_new_cr:
cr.close()
return res
return res or ''
@functools.total_ordering