[views] add max pagination (avoid elasticsearch crash) (closes #17049617)

authorArthur Lutz <arthur.lutz@logilab.fr>
changeset5e539ec0c9b5
branchdefault
phasepublic
hiddenno
parent revision#e6db12c7be33 [es] better escaping of index checking, only if index-name is not None (related #17049617)
child revision#f859339123c8 flake8
files modified by this revision
views.py
# HG changeset patch
# User Arthur Lutz <arthur.lutz@logilab.fr>
# Date 1484652365 -3600
# Tue Jan 17 12:26:05 2017 +0100
# Node ID 5e539ec0c9b53cefd1dddb4a03fd1213d2392e95
# Parent e6db12c7be3355f705dedfcc39329c1b85850200
[views] add max pagination (avoid elasticsearch crash) (closes #17049617)

diff --git a/views.py b/views.py
@@ -213,11 +213,11 @@
1              if current_page - 1 >= 1:
2                  ul(t.li(t.a(self.previous_link,
3                              href=xml_escape(self._cw.build_url(**url_params)))))
4              else:
5                  ul(t.li(t.a(self.previous_link)))
6 -            total_pages = (response.hits.total / 10) + 2
7 +            total_pages = min((response.hits.total / 10) + 2, 1000)
8              page_padding = 3
9 
10              if current_page > page_padding:
11                  for page in range(1,
12                                    min(page_padding + 1,