[view] use the new magic js object to generate javascript func call for auto reload user callbacks stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 30 Jul 2010 13:16:01 +0200
branchstable
changeset 6044 9e48ebd5400c
parent 6043 bfe13118b5aa
child 6045 f414a587075d
[view] use the new magic js object to generate javascript func call for auto reload user callbacks
utils.py
view.py
--- a/utils.py	Fri Jul 30 11:53:16 2010 +0200
+++ b/utils.py	Fri Jul 30 13:16:01 2010 +0200
@@ -15,9 +15,8 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""Some utilities for CubicWeb server/clients.
+"""Some utilities for CubicWeb server/clients."""
 
-"""
 __docformat__ = "restructuredtext en"
 
 import os
--- a/view.py	Fri Jul 30 11:53:16 2010 +0200
+++ b/view.py	Fri Jul 30 13:16:01 2010 +0200
@@ -23,7 +23,6 @@
 from cStringIO import StringIO
 from warnings import warn
 
-from cubicweb.utils import json
 from logilab.common.deprecation import deprecated
 from logilab.mtconverter import xml_escape
 
@@ -33,6 +32,7 @@
 from cubicweb.selectors import yes, non_final_entity, nonempty_rset, none_rset
 from cubicweb.appobject import AppObject
 from cubicweb.utils import UStringIO, HTMLStream
+from cubicweb.uilib import domid, js
 from cubicweb.schema import display_name
 from cubicweb.vregistry import classid
 
@@ -506,12 +506,11 @@
 
     def build_update_js_call(self, cbname, msg):
         rql = self.cw_rset.printable_rql()
-        return "javascript:userCallbackThenUpdateUI('%s', '%s', %s, %s, '%s', '%s')" % (
-            cbname, self.id, json.dumps(rql), json.dumps(msg),
-            self.__registry__, self.div_id())
+        return "javascript: %s" % js.userCallbackThenUpdateUI(
+            cbname, self.__regid__, rql, msg, self.__registry__, self.domid)
 
     def build_reload_js_call(self, cbname, msg):
-        return "javascript:userCallbackThenReloadPage('%s', %s)" % (cbname, json.dumps(msg))
+        return "javascript: %s" % js.userCallbackThenReloadPage(cbname, msg)
 
     build_js = build_update_js_call # expect updatable component by default