backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 08 Dec 2009 19:22:45 +0100
changeset 4059 f1da1a7ef29b
parent 4056 f4634710e20c (current diff)
parent 4058 b3578583b57b (diff)
child 4061 e1fba59b5c34
backport stable
view.py
web/views/navigation.py
--- a/view.py	Tue Dec 08 19:17:57 2009 +0100
+++ b/view.py	Tue Dec 08 19:22:45 2009 +0100
@@ -11,8 +11,11 @@
 
 from cStringIO import StringIO
 
+from simplejson import dumps
+
 from logilab.common.deprecation import deprecated
 from logilab.mtconverter import xml_escape
+
 from rql import nodes
 
 from cubicweb import NotAnEntity
@@ -466,12 +469,13 @@
         return self.build_js(cbname, xml_escape(msg or ''))
 
     def build_update_js_call(self, cbname, msg):
-        rql = xml_escape(self.cw_rset.printable_rql())
-        return "javascript:userCallbackThenUpdateUI('%s', '%s', '%s', '%s', '%s', '%s')" % (
-            cbname, self.__regid__, rql, msg, self.__registry__, self.div_id())
+        rql = self.cw_rset.printable_rql()
+        return "javascript:userCallbackThenUpdateUI('%s', '%s', %s, %s, '%s', '%s')" % (
+            cbname, self.__regid__, dumps(rql), dumps(msg),
+            self.__registry__, self.div_id())
 
-    def build_reload_js_call(self, cbname, msg):
-        return "javascript:userCallbackThenReloadPage('%s', '%s')" % (cbname, msg)
+     def build_reload_js_call(self, cbname, msg):
+         return "javascript:userCallbackThenReloadPage('%s', %s)" % (cbname, dumps(msg))
 
     build_js = build_update_js_call # expect updatable component by default
 
--- a/web/views/navigation.py	Tue Dec 08 19:17:57 2009 +0100
+++ b/web/views/navigation.py	Tue Dec 08 19:22:45 2009 +0100
@@ -173,8 +173,9 @@
 View.pagination = deprecated('.pagination is deprecated, use paginate')(limit_rset_using_paged_nav)
 
 def paginate(view, show_all_option=True, w=None, page_size=None, rset=None):
-    rset = rset or view.cw_rset
-    limit_rset_using_paged_nav(view, view._cw, view.cw_rset, w or view.w,
+    if rset is None:
+        rset = view.rset
+    limit_rset_using_paged_nav(view, view.req, rset, w or view.w,
                                not view.need_navigation, show_all_option,
                                page_size=page_size)
 View.paginate = paginate