restore beahvior in gae that if no limitby, returns iterator

This commit is contained in:
mdipierro
2014-03-31 00:19:04 -05:00
parent 52b55889dd
commit 8d648f6137
3 changed files with 17 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ env:
- DB=mysql://root:@localhost/test_w2p
- DB=postgres://postgres:@localhost/test_w2p
- DB=google:datastore
- DB=google:datastore+ndb
# - DB=google:datastore+ndb
- DB=mongodb://mongodb:mongodb@localhost/test_w2p
- DB=imap://imap:imap@localhost:993
before_script:
@@ -44,8 +44,8 @@ matrix:
env: DB=google:datastore
- python: '2.6'
env: DB=google:datastore
- python: '2.6'
env: DB=google:datastore+ndb
# - python: '2.6'
# env: DB=google:datastore+ndb
script: export COVERAGE_PROCESS_START=gluon/tests/coverage.ini; ./web2py.py --run_system_tests --with_coverage

View File

@@ -1 +1 @@
Version 2.9.5-trunk+timestamp.2014.03.31.00.06.17
Version 2.9.5-trunk+timestamp.2014.03.31.00.18.01

View File

@@ -5223,20 +5223,21 @@ class GoogleDatastoreAdapter(NoSQLAdapter):
if args_get('limitby', None):
(lmin, lmax) = attributes['limitby']
limit, fetch_args = lmax-lmin, {'offset':lmin,'keys_only':True}
else:
limit, fetch_args = self.MAX_FETCH_LIMIT, {'offset':0,'keys_only':True}
if self.use_ndb:
keys, cursor, more = query.fetch_page(limit,**fetch_args)
items = ndb.get_multi(keys)
if self.use_ndb:
keys, cursor, more = query.fetch_page(limit,**fetch_args)
items = ndb.get_multi(keys)
else:
keys = query.fetch(limit, **fetch_args)
items = gae.get(keys)
cursor = query.cursor()
#cursor is only useful if there was a limit and we didn't return
# all results
if args_get('reusecursor'):
db['_lastcursor'] = cursor
else:
keys = query.fetch(limit, **fetch_args)
items = gae.get(keys)
cursor = query.cursor()
#cursor is only useful if there was a limit and we didn't return
# all results
if args_get('reusecursor'):
db['_lastcursor'] = cursor
# if a limit is not specified, always return an iterator
rows = query
return (items, tablename, projection or db[tablename].fields)