if choices is None, call form_field_vocabulary tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 11 Mar 2009 19:52:52 +0100
branchtls-sprint
changeset 1070 3bc7d4ebb543
parent 1069 84bc7dce1876
child 1071 abe11abb37a0
if choices is None, call form_field_vocabulary
web/form.py
--- a/web/form.py	Wed Mar 11 19:51:50 2009 +0100
+++ b/web/form.py	Wed Mar 11 19:52:52 2009 +0100
@@ -488,7 +488,7 @@
         self.label = label or name
         self.id = id or name
         self.initial = initial
-        self.choices = choices or ()
+        self.choices = choices
         self.help = help
         self.eidparam = eidparam
         self.role = 'subject'
@@ -537,7 +537,9 @@
         return self.get_widget(form).render(form, self)
 
     def vocabulary(self, form):
-        return self.choices
+        if self.choices is not None:
+            return self.choices
+        return form.form_field_vocabulary(self)
 
     
 class StringField(Field):