web/formfields.py
branchstable
changeset 3790 34fdb8fb49d1
parent 3689 deb13e88e037
child 3873 4d95109582c7
--- a/web/formfields.py	Mon Nov 02 16:10:03 2009 +0100
+++ b/web/formfields.py	Mon Nov 02 16:37:19 2009 +0100
@@ -203,7 +203,10 @@
         else:
             vocab = form.form_field_vocabulary(self)
         if self.internationalizable:
-            vocab = [(form.req._(label), value) for label, value in vocab]
+            # the short-cirtcuit 'and' boolean operator is used here to permit
+            # a valid empty string in vocabulary without attempting to translate
+            # it by gettext (which can lead to weird strings display)
+            vocab = [(label and form.req._(label), value) for label, value in vocab]
         if self.sort:
             vocab = vocab_sort(vocab)
         return vocab