cubicweb/web/component.py
changeset 11129 97095348b3ee
parent 11082 0cdd92261c4a
parent 11058 23eb30449fe5
child 11767 432f87a63057
--- a/cubicweb/web/component.py	Thu Feb 11 21:59:49 2016 +0100
+++ b/cubicweb/web/component.py	Wed Feb 17 13:45:34 2016 +0100
@@ -71,10 +71,13 @@
         except AttributeError:
             page_size = self.cw_extra_kwargs.get('page_size')
             if page_size is None:
-                if 'page_size' in self._cw.form:
-                    page_size = int(self._cw.form['page_size'])
-                else:
-                    page_size = self._cw.property_value(self.page_size_property)
+                try:
+                    page_size = int(self._cw.form.get('page_size'))
+                except (ValueError, TypeError):
+                    # no or invalid value, fall back
+                    pass
+            if page_size is None:
+                page_size = self._cw.property_value(self.page_size_property)
             self._page_size = page_size
             return page_size