implement vocabulary for Boolean field tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 11 Mar 2009 14:39:42 +0100
branchtls-sprint
changeset 1063 6e55fd09afc4
parent 1062 185d630d1aef
child 1064 e17d57ee8c8c
implement vocabulary for Boolean field
web/form.py
--- a/web/form.py	Wed Mar 11 14:39:15 2009 +0100
+++ b/web/form.py	Wed Mar 11 14:39:42 2009 +0100
@@ -679,6 +679,11 @@
 
 class BooleanField(Field):
     widget = Radio
+        
+    def vocabulary(self, form):
+        if self.choices:
+            return self.choices
+        return [(form.req._('yes'), '1'), (form.req._('no'), '')]
 
 
 class FloatField(IntField):