Pagination should not generate unnecessary prev/next links

Bug #1666760 reported by Jim Baker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
craton
Won't Fix
Undecided
Unassigned

Bug Description

Currently the pagination code in craton.db.sqlalchemy.api._link_params_for generates the following unnecessary links under these conditions:

* prev, even if there is no previous records
* next, even if the query object has already finished with less than limit records

This violates the common reading of the terms of the spec for pagination:

#. If there is a page prior to the current one, we would include the ``prev`` **and** ``first`` relations. These tell the user what the previous page is and what the first page is.

#. If there is a page after the current one, we would include the ``next`` **and** ``last`` relations. These are the opposites to ``prev`` and ``first`` respectively.

(I suppose this can be read differently, such that these links are always present, and we are merely extra affirming their presence when they are useful. But this is an unusual reading.)

Note that fixing this bug does mask problems with regions and projects with respect to parsing marker args, but that can be resolved separately of course. For now this masking is helpful (!) in making progress with the client.

This bug is the real underlying reason why the pagination generator in the client would always make one extra REST API call; see the now invalid https://bugs.launchpad.net/python-cratonclient/+bug/1666381

Jim Baker (jimbaker)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on craton (master)

Change abandoned by Jim Baker (<email address hidden>) on branch: master
Review: https://review.openstack.org/436760
Reason: Such links can be useful in the case of tailing a resource collection, so abandoning. Also we will fix specific pagination problems against resources and projects, vs the workaround this patch would have provided.

Jim Baker (jimbaker)
Changed in craton:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.