# HG changeset patch # User Sylvain Thénault # Date 1309355426 -7200 # Node ID a554010417cea0a60d9bd685669e38ff4ce99d9c # Parent 6386f802fbc60ce2f13a2343ed8237a96735f8c7 [formfields] use support_args instead of catching type error avoid hiding other issues and making debugging difficult diff -r 6386f802fbc6 -r a554010417ce web/formfields.py --- 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 '