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
+8 -1
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: