[views] safety belt around page argument handling (if not an int)

authorArthur Lutz <arthur.lutz@logilab.fr>
changeset14a2e29584cd
branchdefault
phasepublic
hiddenno
parent revision#e6aadade8a9d Added tag 0.4.0, centos/0.4.0-1, debian/0.4.0-1 for changeset 47cbbcc45617
child revision#e6392f5058c4 [pkg] make elasticsearch a new-layout-style cube
files modified by this revision
views.py
# HG changeset patch
# User Arthur Lutz <arthur.lutz@logilab.fr>
# Date 1490943709 -7200
# Fri Mar 31 09:01:49 2017 +0200
# Node ID 14a2e29584cdb21563bf5b0a1c9891b2d9afffee
# Parent e6aadade8a9d9c01a78a04c05b36f6c099f08ace
[views] safety belt around page argument handling (if not an int)

diff --git a/views.py b/views.py
@@ -116,12 +116,15 @@
1              if key == 'parents_for':
2                  parents_for = value
3              if key == 'children_for':
4                  children_for = value
5              if key == 'page':
6 -                start = (max(int(value) - 1, 0)) * 10
7 -                stop = start + 10
8 +                try:
9 +                    start = (max(int(value) - 1, 0)) * 10
10 +                    stop = start + 10
11 +                except ValueError:
12 +                    pass
13          search = self.customize_search(query_string,
14                                         facet_selections,
15                                         start, stop,
16                                         parents_for=parents_for,
17                                         children_for=children_for)