Migrate from JonController to AjaxController
authorPhilippe Pepiot <philippe.pepiot@logilab.fr>
Thu, 17 Oct 2019 15:55:23 +0200
changeset 122 eee88e429e72
parent 121 7c0156c190cd
child 123 7a6ee2c57def
Migrate from JonController to AjaxController
cubicweb_fresh/views/__init__.py
--- a/cubicweb_fresh/views/__init__.py	Tue Oct 15 11:19:48 2019 +0200
+++ b/cubicweb_fresh/views/__init__.py	Thu Oct 17 15:55:23 2019 +0200
@@ -1,8 +1,7 @@
 """template-specific forms/views/actions/components"""
-from logilab.common.decorators import monkeypatch
-
 from cubicweb.web import formwidgets as fw
-from cubicweb.web.views import uicfg, basecontrollers
+from cubicweb.web.views import uicfg
+from cubicweb.web.views.ajaxcontroller import ajaxfunc
 
 _afs = uicfg.autoform_section
 _affk = uicfg.autoform_field_kwargs
@@ -14,8 +13,7 @@
                          autocomplete_settings={'limit': 100, 'delay': 300})})
 
 
-@monkeypatch(basecontrollers.JSonController)
-@basecontrollers.jsonize
+@ajaxfunc(output_type='json')
 def js_get_concerned_by(self):
     term = self._cw.form['q']
     limit = self._cw.form.get('limit', 50)