[views] use ajax_func instead of deprecated api (closes #3603279)
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Mon, 03 Mar 2014 15:08:41 +0100
changeset 130 7554a27b274b
parent 126 a7c2f1122169
child 131 baf594692e62
[views] use ajax_func instead of deprecated api (closes #3603279)
views.py
--- a/views.py	Wed Sep 11 13:53:35 2013 +0200
+++ b/views.py	Mon Mar 03 15:08:41 2014 +0100
@@ -14,6 +14,7 @@
 from cubicweb.view import EntityView
 from cubicweb.web import stdmsgs, uicfg, component, facet
 from cubicweb.web.views import primary, basecontrollers, treeview
+from cubicweb.web.views.ajaxcontroller import ajaxfunc
 
 
 _pvs = uicfg.primaryview_section
@@ -242,16 +243,14 @@
 
 # add some classification schema related methods to the Jsoncontroller ########
 
-@monkeypatch(basecontrollers.JSonController)
-@basecontrollers.jsonize
+@ajaxfunc(output_type='json')
 def js_possible_keywords(self, eid):
     rql = ('DISTINCT Any N WHERE K is Keyword, K name N, NOT K applied_to X, '
            'X eid %(x)s, K included_in C, C classifies ET, X is ET')
     rset = self.cursor.execute(rql, {'x' : eid, 'u' : self._cw.user.eid}, 'x')
     return [name for (name,) in rset]
 
-@monkeypatch(basecontrollers.JSonController)
-@basecontrollers.jsonize
+@ajaxfunc(output_type='json')
 def js_add_keywords(self, eid, kwlist):
     msg = self._cw._('keywords applied')
     kwrset = self.cursor.execute('Any K,N,C WHERE K is Keyword, K name N, K included_in C, '