experimental fix for represent

This commit is contained in:
mdipierro
2015-04-16 16:53:12 -05:00
parent e940228eaf
commit f33ccf3366
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -58,9 +58,12 @@ def represent(field, value, record):
f = field.represent
if not callable(f):
return str(value)
n = f.func_code.co_argcount - len(f.func_defaults or [])
if getattr(f, 'im_self', None):
n -= 1
if hasattr(f,'func_code'):
n = f.func_code.co_argcount - len(f.func_defaults or [])
if getattr(f, 'im_self', None):
n -= 1
else:
n = 1
if n == 1:
return f(value)
elif n == 2: