[views] add max pagination (avoid elasticsearch crash)

authorArthur Lutz <arthur.lutz@logilab.fr>
changeset5b23bcf3be29
branchdefault
phasedraft
hiddenyes
parent revision#72b26fb04f0d [es] better escaping of index checking, only if index-name is not None
child revision#0316c2bedc05 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 5b23bcf3be2924617b75ecb1daa2bfe0e2043155
# Parent 72b26fb04f0de0397b5762bcc6cb6bfd0f78bb70
[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,