27
>>> from canonical.launchpad.webapp.batching import BatchNavigator
28
>>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
27
>>> from canonical.launchpad.webapp.batching import BatchNavigator
28
>>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
30
>>> def build_request(query_string_args=None, method='GET'):
31
... if query_string_args is None:
34
... query_string = "&".join(
35
... ["%s=%s" % (k,v) for k,v in query_string_args.items()])
36
... request = LaunchpadTestRequest(SERVER_URL='http://www.example.com/foo',
38
... environ={'QUERY_STRING': query_string})
39
... request.processInputs()
30
>>> def build_request(query_string_args=None, method='GET'):
31
... if query_string_args is None:
32
... query_string_args = {}
33
... query_string = "&".join(
34
... "%s=%s" % (k,v) for k,v in query_string_args.items())
35
... request = LaunchpadTestRequest(
36
... SERVER_URL='http://www.example.com/foo', method=method,
37
... environ={'QUERY_STRING': query_string})
38
... request.processInputs()
42
41
A dummy request object:
46
>>> reindeer = ['Dasher', 'Dancer', 'Prancer', 'Vixen', 'Comet',
47
... 'Cupid', 'Donner', 'Blitzen', 'Rudolph']
46
... 'Dasher', 'Dancer', 'Prancer', 'Vixen', 'Comet',
47
... 'Cupid', 'Donner', 'Blitzen', 'Rudolph',
58
59
>>> batch_nav.has_multiple_pages
61
>>> one_page_nav = BatchNavigator(select_results, build_request(), size=200)
62
>>> one_page_nav = BatchNavigator(
63
... select_results, build_request(), size=200)
62
64
>>> one_page_nav.has_multiple_pages