Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: appengine/components/components/datastore_utils/utils.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Fixed third parties Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The LUCI Authors. All rights reserved. 1 # Copyright 2015 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 from google.appengine.datastore import datastore_query 5 from google.appengine.datastore import datastore_query
6 from google.appengine.ext import ndb 6 from google.appengine.ext import ndb
7 7
8 8
9 def fetch_page(query, batch_size, cursor_str, **kwargs): 9 def fetch_page(query, batch_size, cursor_str, **kwargs):
10 """Fetches a page from a query. 10 """Fetches a page from a query.
11 11
12 Arguments: 12 Arguments:
13 query: ndb.Query. 13 query: ndb.Query.
(...skipping 14 matching lines...) Expand all
28 raise ValueError( 28 raise ValueError(
29 'cursor must be between valid string, got %r', cursor_str) 29 'cursor must be between valid string, got %r', cursor_str)
30 cursor = datastore_query.Cursor(urlsafe=cursor_str) 30 cursor = datastore_query.Cursor(urlsafe=cursor_str)
31 else: 31 else:
32 cursor = None 32 cursor = None
33 items, cursor, more = query.fetch_page( 33 items, cursor, more = query.fetch_page(
34 batch_size, start_cursor=cursor, **kwargs) 34 batch_size, start_cursor=cursor, **kwargs)
35 if not more: 35 if not more:
36 return items, None 36 return items, None
37 return items, cursor.urlsafe() 37 return items, cursor.urlsafe()
OLDNEW
« no previous file with comments | « appengine/components/components/datastore_utils/txn_test.py ('k') | appengine/components/components/decorators.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698