sorry for delayed response, I now get the following when I used latest
dal.py
from trunk:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\admin\__init__.py", line 295, in post
exec(compiled_code, globals())
File "<string>", line 21, in <module>
File "C:\iargu\gluon\dal.py", line 5063, in insert
return self._db._adapter.insert(self,self._listify(fields))
File "C:\iargu\gluon\dal.py", line 3464, in insert
tmp = table._tableobj(**dfields)
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\db\__init__.py", line 945, in __init__
prop.__set__(self, value)
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\db\__init__.py", line 3603, in __set__
value = self.validate(value)
File "C:\Program Files\Google\google_appengine\google\appengine\ext
\db\__init__.py", line 3635, in validate
if value is not None and not value.has_key():
AttributeError: 'unicode' object has no attribute 'has_key'
On Nov 3, 2:55 pm, 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