issue 912, handle lists of more than 30 references on GAE, thanks Howesc

This commit is contained in:
mdipierro
2012-07-28 19:11:16 -05:00
parent 89e4caa9df
commit 9db2afdd06
3 changed files with 13 additions and 6 deletions

View File

@@ -1 +1 @@
Version 2.00.0 (2012-07-28 02:24:05) dev
Version 2.00.0 (2012-07-28 19:11:10) dev

View File

@@ -240,19 +240,19 @@ def site():
fname = form_update.vars.url
elif form_update.accepted and form_update.vars.file:
fname = form_update.vars.file.filename
fname = request.vars.file.filename
appname = cleanpath(form_update.vars.name)
installed = app_install(appname, form_update.vars.file.file,
installed = app_install(appname, request.vars.file.file,
request, fname,
overwrite=form_update.vars.overwrite)
if f and installed:
if installed:
msg = 'application %(appname)s installed with md5sum: %(digest)s'
if MULTI_USER_MODE:
db.app.insert(name=appname,owner=auth.user.id)
log_progress(appname)
session.flash = T(msg, dict(appname=appname,
digest=md5_hash(installed)))
elif f and form_update.vars.overwrite:
elif form_update.vars.overwrite:
msg = 'unable to install application "%(appname)s"'
session.flash = T(msg, dict(appname=form_update.vars.name))

View File

@@ -6099,7 +6099,14 @@ def sqlhtml_validators(field):
def list_ref_repr(ids, row=None, r=referenced, f=ff):
if not ids:
return None
refs = r._db(r._id.belongs(ids)).select(r._id)
if isinstance(r._db._adapter, GoogleDatastoreAdapter):
for i in xrange(0, len(ids), 30):
if not refs:
refs = r._db(r._id.belongs(ids[i:i+30])).select(r._id)
else:
refs = refs & r._db(r._id.belongs(ids[i:i+30])).select(r._id)
else:
refs = r._db(r._id.belongs(ids)).select(r._id)
return (refs and ', '.join(str(f(r,ref.id)) for ref in refs) or '')
field.represent = field.represent or list_ref_repr
if hasattr(referenced, '_format') and referenced._format: