← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~leonardr/launchpad/optimized-length-2 into lp:launchpad

 

Leonard Richardson has proposed merging lp:~leonardr/launchpad/optimized-length-2 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


This branch integrates the newest version of lazr.restful, which sends 'total_size' instead of 'total_size_link' if it's easy to figure out the total size of a collection. The changes to datamodel.txt show when this happens.
-- 
https://code.launchpad.net/~leonardr/launchpad/optimized-length-2/+merge/33417
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~leonardr/launchpad/optimized-length-2 into lp:launchpad.
=== modified file 'lib/canonical/launchpad/pagetests/webservice/datamodel.txt'
--- lib/canonical/launchpad/pagetests/webservice/datamodel.txt	2010-08-19 14:38:10 +0000
+++ lib/canonical/launchpad/pagetests/webservice/datamodel.txt	2010-08-23 16:44:52 +0000
@@ -7,29 +7,39 @@
 end-to-end tests of code paths that, on the surface, look like they're
 already tested in lazr.restful.
 
-  >>> def get_collection(version, start=0, size=2):
+  >>> def get_collection(version="devel", start=0, size=2):
   ...     collection = webservice.get(
   ...         ("/people?ws.op=find&text=s&ws.start=%s&ws.size=%s" %
   ...          (start, size)),
   ...         api_version=version)
   ...     return collection.jsonBody()
 
-Even if an entire collection fits on one page (so that the total size
-of the collection is obvious), 'total_size_link' will be served
-instead of 'total_size'. (It would be nice to fix this.)
-
-  >>> collection = get_collection("devel", size=100)
+
+Normally, the total size of a collection is not served along with the
+collection; it's available by following the total_size_link.
+
+  >>> collection = get_collection()
   >>> print sorted(collection.keys())
   [u'entries', u'start', u'total_size_link']
   >>> print webservice.get(collection['total_size_link']).jsonBody()
   9
 
-Even if the last page of the collection is fetched (so that the total
-size of the collection is semi-obvious), 'total_size_link' will be
-served instead of 'total_size'. (It would be nice to fix this.)
-
-  >>> collection = get_collection("devel", start=8)
-  >>> print sorted(collection.keys())
-  [u'entries', u'prev_collection_link', u'start', u'total_size_link']
-  >>> print webservice.get(collection['total_size_link']).jsonBody()
+If an entire collection fits on one page (making the size of the
+collection obvious), 'total_size' is served instead of
+'total_size_link'.
+
+  >>> collection = get_collection(size=100)
+  >>> print sorted(collection.keys())
+  [u'entries', u'start', u'total_size']
+  >>> print collection['total_size']
+  9
+
+If the last page of the collection is fetched (making the total size
+of the collection semi-obvious), 'total_size' is served instead of
+'total_size_link'.
+
+  >>> collection = get_collection(start=8)
+  >>> print sorted(collection.keys())
+  [u'entries', u'prev_collection_link', u'start', u'total_size']
+  >>> print collection['total_size']
   9

=== modified file 'versions.cfg'
--- versions.cfg	2010-08-18 19:41:20 +0000
+++ versions.cfg	2010-08-23 16:44:52 +0000
@@ -31,7 +31,7 @@
 lazr.delegates = 1.2.0
 lazr.enum = 1.1.2
 lazr.lifecycle = 1.1
-lazr.restful = 0.11.1
+lazr.restful = 0.11.2
 lazr.restfulclient = 0.10.0
 lazr.smtptest = 1.1
 lazr.testing = 0.1.1