Mercurial > libervia-web
changeset 1465:a410db730301
pages: keep `page_max` if set in query params in `setPagination`:
rel 399
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 30 Sep 2021 17:01:20 +0200 (2021-09-30) |
parents | a8435aebfbcc |
children | cff720e26089 |
files | libervia/server/pages.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/server/pages.py Thu Sep 30 17:00:06 2021 +0200 +++ b/libervia/server/pages.py Thu Sep 30 17:01:20 2021 +0200 @@ -987,13 +987,13 @@ extra['rsm_before'] = "" return extra - def setPagination(self, request, pubsub_data): + def setPagination(self, request: server.Request, pubsub_data: dict) -> None: """Add to template_data if suitable "previous_page_url" and "next_page_url" will be added using respectively "before" and "after" URL parameters - @param request(server.Request): current HTTP request - @param pubsub_data(dict): pubsub metadata + @param request: current HTTP request + @param pubsub_data: pubsub metadata """ template_data = request.template_data extra = {} @@ -1009,6 +1009,11 @@ if search is not None: extra['search'] = search.strip() + # same for page_max + page_max = self.getPostedData(request, 'page_max', raise_on_missing=False) + if page_max is not None: + extra['page_max'] = page_max + if rsm.get("index", 1) > 0: # We only show previous button if it's not the first page already. # If we have no index, we default to display the button anyway