web/formfields.py
changeset 7574 34154f48d255
parent 7462 fbfde96437ad
parent 7572 a554010417ce
child 7756 98e34ae4cf89
--- a/web/formfields.py	Tue Jun 28 17:59:31 2011 +0200
+++ b/web/formfields.py	Wed Jun 29 16:04:01 2011 +0200
@@ -1,4 +1,4 @@
-# copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -387,12 +387,11 @@
         """
         assert self.choices is not None
         if callable(self.choices):
-            try:
-                if getattr(self.choices, 'im_self', None) is self:
-                    vocab = self.choices(form=form, **kwargs)
-                else:
-                    vocab = self.choices(form=form, field=self, **kwargs)
-            except TypeError:
+            if getattr(self.choices, 'im_self', None) is self:
+                vocab = self.choices(form=form, **kwargs)
+            elif support_args(self.choices, 'form', 'field'):
+                vocab = self.choices(form=form, field=self, **kwargs)
+            else:
                 try:
                     vocab = self.choices(form=form, **kwargs)
                     warn('[3.6]  %s: choices should now take '