# HG changeset patch # User Julien Cristau # Date 1451986577 -3600 # Node ID 0cdd92261c4af0f208832e9b30a32928b6fd8013 # Parent 70733b2dfd2af50e042be880d5652d2f36524f24 [web/component] guard against invalid page_size form parameter Same as dff28956f37e, except the almost same code exists in two places (yay us). diff -r 70733b2dfd2a -r 0cdd92261c4a web/component.py --- 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