Include query parameters in API pagination links.

Review Request #5344 — Created Jan. 28, 2014 and submitted

Information

Djblets
release-0.7.x

Reviewers

Include query parameters in API pagination links.

The 'next' and 'previous' links for pagination were stripping out any query
parameters which had been passed into the list resource, which effectively
broke them (since the results would probably be different). This change adds
all of the query parameters into the returned URLs.

Fetched the review-request-list resource using some query parameters and saw
that the pagination links included the same ones that I passed in and that the
only things that changed were 'start' and 'max-results'.

Description From Last Updated

This needs to handle escaping, and I think it could be a little more readable. How about: from urllib import …

chipx86chipx86
chipx86
  1. 
      
  2. djblets/webapi/core.py (Diff revision 1)
     
     
     
     
    Show all issues

    This needs to handle escaping, and I think it could be a little more readable. How about:

    from urllib import quote
    
    ...
    
    query_parameters = '&'.join([
        '%s=%s' % (quote(k), quote(v))
        for k, v in request.GET.iteritems()
        if k not in ('start', 'max-results')
    ])
    
    if query_parameters:
        ...
    
  3. 
      
david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.7.x (4b656f2)