<div dir="ltr">The way paginated links are defined by the v3 API (via `next` and `previous` links), it can be completely up to the driver as to what the query parameters look like. So, the client shouldn't have (nor require) any knowledge of how to build query parameters for pagination. It just needs to follow the links it's given.<div>
<br></div><div>'page' and 'per_page' are trivial for the controller to implement (as it's just slicing into an list... as shown)... so that's a reasonable default behavior (for when a driver does not support pagination). However, if the underlying driver DOES support pagination, it should provide a way for the controller to ask for the query parameters required to specify the next/previous links (so, one driver could return `marker` and `limit` parameters while another only exposes the `page` number, but not quantity `per_page`).</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Aug 12, 2013 at 4:34 PM, Henry Nash <span dir="ltr"><<a href="mailto:henryn@linux.vnet.ibm.com" target="_blank">henryn@linux.vnet.ibm.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi<div><br></div><div>I'm working on extending the pagination into the backends.  Right now, we handle the pagination in the v3 controller class....and in fact it is disabled right now and we return the whole list irrespective of whether page/per-page is set in the query string, e.g.:</div>
<div><br></div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica">    <span style="color:#063ff4">def</span> <b>paginate</b>(cls, context, refs):</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica;color:rgb(0,179,57)"><span style="color:#000000">        </span><i>"""Paginates a list of references by page & per_page query strings."""</i></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica;color:rgb(203,203,203)"><span style="color:#000000">        </span># FIXME(<span style="text-decoration:underline">dolph</span>): client needs to support pagination first</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica">        <span style="color:#063ff4">return</span> refs</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica;min-height:12px">
<br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica">        page = context[<span style="color:#00b339"><i>'query_string'</i></span>].get(<span style="color:#00b339"><i>'page'</i></span>, <span style="color:#950f0b">1</span>)</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica">        per_page = context[<span style="color:#00b339"><i>'query_string'</i></span>].get(<span style="color:#00b339"><i>'per_page'</i></span>, <span style="color:#950f0b">30</span>)</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica">        <span style="color:#063ff4">return</span> refs[per_page * (page - <span style="color:#950f0b">1</span>):per_page * page]</div>
</div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica"><br></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica">
<font size="3">I wonder both for the V3 controller (which still needs to handle pagination for backends that do not support it) and the backends that do....whether we could use wether 'page' is defined in the query-string as an indicator as to whether we should paginate or not?  That way clients who can handle it can ask for it, those that don'twill just get everything.  </font></div>
<span class="HOEnZb"><font color="#888888"><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica"><font size="3"><br></font></div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 10px/normal Helvetica">
<font size="3">Henry</font></div><div><br></div></font></span></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><br></div>-Dolph
</div>