# HG changeset patch # User Goffi # Date 1619108627 -7200 # Node ID 80683be8d341f39193b668d6a6f51f3f44b2d128 # Parent 83b477d367253f051cfafe463157f50ff07b6255 pages: keep `search` query when using pagination diff -r 83b477d36725 -r 80683be8d341 libervia/server/pages.py --- a/libervia/server/pages.py Thu Apr 22 18:22:49 2021 +0200 +++ b/libervia/server/pages.py Thu Apr 22 18:23:47 2021 +0200 @@ -970,6 +970,7 @@ @param pubsub_data(dict): pubsub metadata """ template_data = request.template_data + extra = {} try: rsm = pubsub_data["rsm"] last_id = rsm["last"] @@ -977,17 +978,23 @@ # no pagination available return + # if we have a search query, we must keep it + search = self.getPostedData(request, 'search', raise_on_missing=False) + if search is not None: + extra['search'] = search.strip() + 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 # as we can't know if we are on the first page or not. first_id = rsm["first"] - template_data['previous_page_url'] = self.getParamURL(request, - before=first_id) + template_data['previous_page_url'] = self.getParamURL( + request, before=first_id, **extra) if not pubsub_data["complete"]: # we also show the page next button if complete is None because we # can't know where we are in the feed in this case. - template_data['next_page_url'] = self.getParamURL(request, after=last_id) + template_data['next_page_url'] = self.getParamURL( + request, after=last_id, **extra) ## Cache handling ##