web/formfields.py
branchstable
changeset 2196 b08521e4eaab
parent 2146 6645e18e8c93
child 2244 52e2431e7cce
--- a/web/formfields.py	Mon Jun 29 17:02:51 2009 +0200
+++ b/web/formfields.py	Mon Jun 29 17:14:05 2009 +0200
@@ -164,7 +164,12 @@
         widgets which desire it."""
         if self.choices is not None:
             if callable(self.choices):
-                vocab = self.choices(req=form.req)
+                try:
+                    vocab = self.choices(form=form)
+                except TypeError:
+                    warn('vocabulary method (eg field.choices) should now take '
+                         'the form instance as argument', DeprecationWarning)
+                    vocab = self.choices(req=form.req)
             else:
                 vocab = self.choices
             if vocab and not isinstance(vocab[0], (list, tuple)):