--- a/devtools/fill.py Fri Sep 18 17:58:30 2015 +0200
+++ b/devtools/fill.py Tue Sep 22 15:25:25 2015 +0200
@@ -26,6 +26,7 @@
from copy import deepcopy
from datetime import datetime, date, time, timedelta
from decimal import Decimal
+import inspect
from six import text_type, add_metaclass
from six.moves import range
@@ -258,7 +259,7 @@
for attrname, attrvalue in classdict.items():
if callable(attrvalue):
if attrname.startswith('generate_') and \
- attrvalue.func_code.co_argcount < 2:
+ len(inspect.getargspec(attrvalue).args) < 2:
raise TypeError('generate_xxx must accept at least 1 argument')
setattr(_ValueGenerator, attrname, attrvalue)
return type.__new__(mcs, name, bases, classdict)
--- a/web/views/forms.py Fri Sep 18 17:58:30 2015 +0200
+++ b/web/views/forms.py Tue Sep 22 15:25:25 2015 +0200
@@ -48,6 +48,7 @@
from warnings import warn
import time
+import inspect
from logilab.common import dictattr, tempattr
from logilab.common.decorators import iclassmethod, cached
@@ -257,7 +258,7 @@
editedfields = self._cw.form['_cw_fields']
except KeyError:
raise RequestError(self._cw._('no edited fields specified'))
- entityform = entity and self.field_by_name.im_func.func_code.co_argcount == 4 # XXX
+ entityform = entity and len(inspect.getargspec(self.field_by_name)) == 4 # XXX
for editedfield in splitstrip(editedfields):
try:
name, role = editedfield.split('-')