In the latest dal.py around line 3010 (may float a bit, I am looking
at the trunk)
if self.dbengine == 'google:datastore' in globals():http://
groups.google.com/group/web2py/browse_thread/thread/
33b722be4316472a#Change it toif self.dbengine ==
'google:datastore':and the exception will go away
The issue is that'GoogleDatastoreAdapter' is in globals(), not
'google:datastore'Also 'GQLDB' is in globals()
I have been settingdb=DAL('google:datastore') Should it be something
else????
On Nov 3, 9:55 am, Massimo Di Pierro <[email protected]>
wrote:
> I think I just fixed this in trunk, please check.
>
> On Nov 3, 9:34 am, Murray3 <[email protected]> wrote:
>
>
>
>
>
>
>
> > I thought this would work with custom SQL
> > Using latest version of web2py in gae interactive console I have for
> > testing purposes:
>
> > from gluon.contrib.gql import gae
> > from gluon.dal import *
> > db = DAL('gae')
> > db.define_table('Contact',
> > Field('name', 'string'))
> > db.define_table('PhoneNumber',
> > Field('contact',
> > gae.ReferenceProperty()),
> > Field('phone_type', 'string'),
> > Field('number', 'string'))
>
> > db.Contact.insert(name='Scotty')
> > from google.appengine.api.datastore_types import Key
>
> > rows = db(db.Contact.name=='Scotty').select()
> > selected_row = rows[0]
> > key = Key.from_path("Contact",selected_row.id)
>
> > db.PhoneNumber.insert(contact=key,
> > phone_type='home',
> > number='(650) 555 - 2200')
> > db.PhoneNumber.insert(contact=key,
> > phone_type='mobile',
> > number='(650) 555 - 2201')
>
> > entity_keyselect = db(db.PhoneNumber.contact == key).select()
> > print 'Content-Type: text/html'
> > print
> > for c in entity_keyselect:
> > print '%s: %s' % (c.phone_type, c.number)
>
> > I get returned error:
>
> > Traceback (most recent call last):
> > File "C:\Python25\google\appengine\ext\admin\__init__.py", line 247,
> > in post
> > exec(compiled_code, globals())
> > File "<string>", line 21, in <module>
> > File "C:\Python25\content\gluon\dal.py", line 5031, in insert
> > return self._db._adapter.insert(self,self._listify(fields))
> > File "C:\Python25\content\gluon\dal.py", line 3436, in insert
> > dfields=dict((f.name,self.represent(v,f.type)) for f,v in fields)
> > File "C:\Python25\content\gluon\dal.py", line 3436, in <genexpr>
> > dfields=dict((f.name,self.represent(v,f.type)) for f,v in fields)
> > File "C:\Python25\content\gluon\dal.py", line 2990, in represent
> > if fieldtype.startswith('list:'):
> > AttributeError: 'ReferenceProperty' object has no attribute
> > 'startswith'
>
> > Any help Aprreciated
> > Chris