[predicates] guard against non-integer page_size form parameter
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 04 Nov 2015 11:26:22 +0100
changeset 10826 dff28956f37e
parent 10825 56ca5f6e0533
child 10827 768d332de17b
[predicates] guard against non-integer page_size form parameter Closes #8123231
predicates.py
--- a/predicates.py	Tue Nov 03 15:56:39 2015 +0100
+++ b/predicates.py	Wed Nov 04 11:26:22 2015 +0100
@@ -492,10 +492,13 @@
         page_size = kwargs.get('page_size')
         if page_size is None:
             page_size = req.form.get('page_size')
+            if page_size is not None:
+                try:
+                    page_size = int(page_size)
+                except ValueError:
+                    page_size = None
             if page_size is None:
                 page_size = req.property_value('navigation.page-size')
-            else:
-                page_size = int(page_size)
         if len(rset) <= (page_size*self.nbpages):
             return 0
         return self.nbpages