I did some digging around:
After i changed this piece of code in GoogleDatastoreAdapter, the cacheable
attribute was passed to the *parse() *method in BaseAdapter.
Before the change it wasn't and thus cacheable was always the default value
False.
def select(self,query,fields,attributes):
[...]
colnames = ['%s.%s' % (tablename, t) for t in fields]
processor = attributes.get('processor',self.parse)
*cacheable = attributes.get('cacheable',False)*
# return processor(rows,fields,colnames,False)
* return processor(rows,fields,colnames,False, cacheable=cacheable)*
after this change i noticed that in the resulting Rows, the "id" prop
contained an instance of my model in stead of a numeric id.
So i changed some lines in parse() in BaseAdapter and after those changes,
the resulting rows collection looks alright:
*old:*
if ft == 'id' and not cacheable:
# temporary hack to deal with
# GoogleDatastoreAdapter
# references
if isinstance(self, GoogleDatastoreAdapter):
id = value.key().id_or_name()
colset[fieldname] = id
colset.gae_item = value
else:
id = value
colset.update_record = RecordUpdater(colset,table,id)
colset.delete_record = RecordDeleter(table,id)
for rfield in table._referenced_by:
referee_link = db._referee_name and \
db._referee_name % dict(
table=rfield.tablename,field=rfield.name)
if referee_link and not referee_link in colset:
colset[referee_link] = LazySet(rfield,id)
*new:*
*
*
if ft == 'id':
# temporary hack to deal with
# GoogleDatastoreAdapter
# references
if isinstance(self, GoogleDatastoreAdapter):
id = value.key().id_or_name()
colset[fieldname] = id
colset.gae_item = value
else:
id = value
if not cacheable:
colset.update_record = RecordUpdater(colset,table,id)
colset.delete_record = RecordDeleter(table,id)
for rfield in table._referenced_by:
referee_link = db._referee_name and \
db._referee_name % dict(
table=rfield.tablename,field=rfield.name)
if referee_link and not referee_link in colset:
colset[referee_link] = LazySet(rfield,id)
But i'm still getting the same error. So it looks like "cacheable=True"
does not solve this error.
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.