[web/ajax] fix AjaxController on python3
authorJulien Cristau <julien.cristau@logilab.fr>
Thu, 01 Oct 2015 11:50:42 +0200
changeset 10750 1166a47dad40
parent 10749 2703116e4b21
child 10751 9ffdfa1d28f5
[web/ajax] fix AjaxController on python3
web/views/ajaxcontroller.py
--- a/web/views/ajaxcontroller.py	Thu Oct 01 11:50:09 2015 +0200
+++ b/web/views/ajaxcontroller.py	Thu Oct 01 11:50:42 2015 +0200
@@ -66,7 +66,7 @@
 from warnings import warn
 from functools import partial
 
-from six import text_type
+from six import PY2, text_type
 
 from logilab.common.date import strptime
 from logilab.common.registry import yes
@@ -119,7 +119,9 @@
             raise RemoteCallFailed('no method specified')
         # 1/ check first for old-style (JSonController) ajax func for bw compat
         try:
-            func = getattr(basecontrollers.JSonController, 'js_%s' % fname).im_func
+            func = getattr(basecontrollers.JSonController, 'js_%s' % fname)
+            if PY2:
+                func = func.__func__
             func = partial(func, self)
         except AttributeError:
             # 2/ check for new-style (AjaxController) ajax func