page_size can be given in url attributes
authorArthur Lutz <arthur.lutz@logilab.fr>
Tue, 10 Feb 2009 18:12:43 +0100
changeset 593 6f6549780096
parent 592 aae01d81c713
child 594 76218d42d21f
page_size can be given in url attributes
common/selectors.py
web/component.py
--- a/common/selectors.py	Tue Feb 10 18:12:10 2009 +0100
+++ b/common/selectors.py	Tue Feb 10 18:12:43 2009 +0100
@@ -163,7 +163,11 @@
     """
     page_size = kwargs.get('page_size')
     if page_size is None:
-        page_size = req.property_value('navigation.page-size')
+        page_size = req.form.get('page_size')
+        if page_size is None:
+            page_size = req.property_value('navigation.page-size')
+        else:
+            page_size = int(page_size)
     if rset is None or len(rset) <= page_size:
         return 0
     return 1
--- a/web/component.py	Tue Feb 10 18:12:10 2009 +0100
+++ b/web/component.py	Tue Feb 10 18:12:43 2009 +0100
@@ -83,6 +83,8 @@
         instance = super(NavigationComponent, cls).selected(req, rset, row, col, **kwargs)
         if page_size is not None:
             instance.page_size = page_size
+        elif 'page_size' in req.form:
+            instance.page_size = int(req.form['page_size'])
         return instance
     
     def __init__(self, req, rset):