[views] add max pagination (avoid elasticsearch crash)

authorArthur Lutz <arthur.lutz@logilab.fr>
changeset9251b14d9244
branchdefault
phasedraft
hiddenyes
parent revision#ef1ad2c7b298 [es] better escaping of index checking, only if index-name is not None
child revision#fca664268720 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 9251b14d9244f1578694cf95b323b22c1c4696eb
# Parent ef1ad2c7b298d4371282df649b187e68e9e14d48
[views] add max pagination (avoid elasticsearch crash)

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,