[web/form] Relax condition for non-translating field names 3.25
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 05 Oct 2017 17:24:29 +0200
branch3.25
changeset 12204 95e0883e2375
parent 12202 1c912b7d9503
child 12205 a97cdb531a75
[web/form] Relax condition for non-translating field names we should test true condition instead of None, so if one raise a ValidationError using an empty string as 'no-field' marker instead of None, we don't get the PO file header that gettext likes to return when one attempt to translate an empty string.
cubicweb/web/views/formrenderers.py
--- a/cubicweb/web/views/formrenderers.py	Tue Sep 26 10:46:43 2017 +0200
+++ b/cubicweb/web/views/formrenderers.py	Thu Oct 05 17:24:29 2017 +0200
@@ -172,7 +172,7 @@
                 else:
                     templstr = u'&#160;%s\n'
                 for field, err in errors:
-                    if field is None:
+                    if not field:
                         errormsg += templstr % err
                     else:
                         errormsg += templstr % '%s: %s' % (req._(field), err)