[formfields] use support_args instead of catching type error avoid hiding other issues and making debugging difficult
--- a/web/formfields.py Wed Jun 29 15:49:47 2011 +0200
+++ b/web/formfields.py Wed Jun 29 15:50:26 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.
@@ -386,12 +386,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 '