[navigation] view may implements page_navigation_url to handle them self url generated for pagination stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 01 Jun 2010 12:20:16 +0200
branchstable
changeset 5616 859225caf375
parent 5615 cfa9a776d99a
child 5617 f0bc8f5ddee2
[navigation] view may implements page_navigation_url to handle them self url generated for pagination
web/component.py
web/views/navigation.py
--- a/web/component.py	Tue Jun 01 12:19:01 2010 +0200
+++ b/web/component.py	Tue Jun 01 12:20:16 2010 +0200
@@ -130,7 +130,10 @@
         params = dict(params)
         params.update({self.start_param : start,
                        self.stop_param : stop,})
-        if path == 'json':
+        view = self.cw_extra_kwargs.get('view')
+        if view is not None and hasattr(view, 'page_navigation_url'):
+            url = view.page_navigation_url(self, path, params)
+        elif path == 'json':
             rql = params.pop('rql', self.cw_rset.printable_rql())
             # latest 'true' used for 'swap' mode
             url = 'javascript: replacePageChunk(%s, %s, %s, %s, true)' % (
--- a/web/views/navigation.py	Tue Jun 01 12:19:01 2010 +0200
+++ b/web/views/navigation.py	Tue Jun 01 12:20:16 2010 +0200
@@ -237,7 +237,7 @@
     if w is None:
         w = view.w
     nav = req.vreg['components'].select_or_none(
-        'navigation', req, rset=rset, page_size=page_size)
+        'navigation', req, rset=rset, page_size=page_size, view=view)
     if nav:
         if w is None:
             w = view.w