[widgets] handle no value label for tristate radios, put default separator on class for easier redefinition - closes #1624839
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Fri, 15 Apr 2011 12:58:31 +0200
changeset 7231 18bcb98d129a
parent 7229 a60522259c2c
child 7233 614f23606091
[widgets] handle no value label for tristate radios, put default separator on class for easier redefinition - closes #1624839
i18n/de.po
i18n/en.po
i18n/es.po
i18n/fr.po
web/formfields.py
web/formwidgets.py
--- a/i18n/de.po	Fri Apr 15 08:22:38 2011 +0200
+++ b/i18n/de.po	Fri Apr 15 12:58:31 2011 +0200
@@ -2755,6 +2755,9 @@
 "zeigt an, welcher Zustand standardmäßig benutzt werden soll, wenn eine "
 "Entität erstellt wird"
 
+msgid "indifferent"
+msgstr "gleichgültig"
+
 msgid "info"
 msgstr "Information"
 
--- a/i18n/en.po	Fri Apr 15 08:22:38 2011 +0200
+++ b/i18n/en.po	Fri Apr 15 12:58:31 2011 +0200
@@ -2680,6 +2680,9 @@
 "is created"
 msgstr ""
 
+msgid "indifferent"
+msgstr "indifferent"
+
 msgid "info"
 msgstr ""
 
--- a/i18n/es.po	Fri Apr 15 08:22:38 2011 +0200
+++ b/i18n/es.po	Fri Apr 15 12:58:31 2011 +0200
@@ -2785,6 +2785,9 @@
 msgstr ""
 "Indica cual estado deberá ser utilizado por defecto al crear una entidad"
 
+msgid "indifferent"
+msgstr "indifferente"
+
 msgid "info"
 msgstr "Información del Sistema"
 
--- a/i18n/fr.po	Fri Apr 15 08:22:38 2011 +0200
+++ b/i18n/fr.po	Fri Apr 15 12:58:31 2011 +0200
@@ -2795,6 +2795,9 @@
 msgstr ""
 "indique quel état devrait être utilisé par défaut lorsqu'une entité est créée"
 
+msgid "indifferent"
+msgstr "indifférent"
+
 msgid "info"
 msgstr "information"
 
--- a/web/formfields.py	Fri Apr 15 08:22:38 2011 +0200
+++ b/web/formfields.py	Fri Apr 15 12:58:31 2011 +0200
@@ -875,7 +875,9 @@
         if self.choices:
             return super(BooleanField, self).vocabulary(form)
         if self.allow_none:
-            return [('', ''), (form._cw._('yes'), '1'), (form._cw._('no'), '0')]
+            return [(form._cw._('indifferent'), ''),
+                    (form._cw._('yes'), '1'),
+                    (form._cw._('no'), '0')]
         # XXX empty string for 'no' in that case for bw compat
         return [(form._cw._('yes'), '1'), (form._cw._('no'), '')]
 
--- a/web/formwidgets.py	Fri Apr 15 08:22:38 2011 +0200
+++ b/web/formwidgets.py	Fri Apr 15 12:58:31 2011 +0200
@@ -478,11 +478,12 @@
     default <br/> is used.
     """
     type = 'checkbox'
+    default_separator = u'<br/>\n'
     vocabulary_widget = True
 
-    def __init__(self, attrs=None, separator=u'<br/>\n', **kwargs):
+    def __init__(self, attrs=None, separator=None, **kwargs):
         super(CheckBox, self).__init__(attrs, **kwargs)
-        self.separator = separator
+        self.separator = separator or self.default_separator
 
     def _render(self, form, field, renderer):
         curvalues, attrs = self.values_and_attributes(form, field)