web/component.py
changeset 11082 0cdd92261c4a
parent 10903 da30851f9706
--- a/web/component.py	Tue Jan 05 10:31:29 2016 +0100
+++ b/web/component.py	Tue Jan 05 10:36:17 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