web/views/ajaxcontroller.py
changeset 10750 1166a47dad40
parent 10729 6ca54ea4ba4d
equal deleted inserted replaced
10749:2703116e4b21 10750:1166a47dad40
    64 __docformat__ = "restructuredtext en"
    64 __docformat__ = "restructuredtext en"
    65 
    65 
    66 from warnings import warn
    66 from warnings import warn
    67 from functools import partial
    67 from functools import partial
    68 
    68 
    69 from six import text_type
    69 from six import PY2, text_type
    70 
    70 
    71 from logilab.common.date import strptime
    71 from logilab.common.date import strptime
    72 from logilab.common.registry import yes
    72 from logilab.common.registry import yes
    73 from logilab.common.deprecation import deprecated
    73 from logilab.common.deprecation import deprecated
    74 
    74 
   117             fname = self._cw.form['fname']
   117             fname = self._cw.form['fname']
   118         except KeyError:
   118         except KeyError:
   119             raise RemoteCallFailed('no method specified')
   119             raise RemoteCallFailed('no method specified')
   120         # 1/ check first for old-style (JSonController) ajax func for bw compat
   120         # 1/ check first for old-style (JSonController) ajax func for bw compat
   121         try:
   121         try:
   122             func = getattr(basecontrollers.JSonController, 'js_%s' % fname).im_func
   122             func = getattr(basecontrollers.JSonController, 'js_%s' % fname)
       
   123             if PY2:
       
   124                 func = func.__func__
   123             func = partial(func, self)
   125             func = partial(func, self)
   124         except AttributeError:
   126         except AttributeError:
   125             # 2/ check for new-style (AjaxController) ajax func
   127             # 2/ check for new-style (AjaxController) ajax func
   126             try:
   128             try:
   127                 func = self._cw.vreg['ajax-func'].select(fname, self._cw)
   129                 func = self._cw.vreg['ajax-func'].select(fname, self._cw)