[web/component] guard against invalid page_size form parameter
Same as dff28956f37e, except the almost same code exists in two places
(yay us).
--- 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