Here is a patch that fixes the bug in gql.py and adds self references to the doctests.
http://code.google.com/p/web2py/issues/detail?id=25 Thanks for uncovering the bug. Robin On Jan 24, 8:14 pm, "Sebastian E. Ovide" <[email protected]> wrote: > I-m using the last stable> Version 1.55.2 (2009-01-08 > 08:38:01)<http://mdp.cti.depaul.edu/examples/default/download> > > On Sat, Jan 24, 2009 at 11:31 PM, Robin B <[email protected]> wrote: > > > It is certainly a bug. > > > Either the person table is not initialized yet since it is referencing > > itself, or there is something funny going on with getitem. > > > What revision of what repository is the source code? > > > Robin > > > On Jan 24, 5:23 pm, "Sebastian E. Ovide" <[email protected]> > > wrote: > > > Hi All, > > > > I have a model that works well with SQLite but it doesn't with GAE > > > > db.define_table('person', > > > SQLField('name'), > > > SQLField('email'), > > > SQLField('phone'), > > > SQLField('foto','upload'), > > > SQLField('manager','reference person') > > > ) > > > db.person.name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'person.name')] > > > db.person.manager.requires=IS_IN_DB(db,'person.id','%(name)s') > > > db.person.email.requires=[IS_EMAIL(),IS_NOT_IN_DB(db,'person.email')] > > > db.person.phone.requires=IS_NOT_EMPTY() > > > > under GAE I get > > > > ERROR 2009-01-24 23:11:12,654 main.py] Traceback (most recent call > > last): > > > File "C:\dev\web2py\gluon\restricted.py", line 62, in restricted > > > exec ccode in environment > > > File "C:\dev\web2py\applications\personal/models/db.py", line 35, in > > > <module> > > > SQLField('manager','reference person') > > > File "C:\dev\web2py\gluon\contrib\gql.py", line 108, in define_table > > > t._create() > > > File "C:\dev\web2py\gluon\contrib\gql.py", line 171, in _create > > > ftype=self._db._translator[field.type[:9]](self._db[referenced]._tableobj) > > > File "C:\dev\web2py\gluon\sql.py", line 339, in __getattr__ > > > def __getattr__(self, key): return self[key] > > > File "C:\dev\web2py\gluon\sql.py", line 337, in __getitem__ > > > def __getitem__(self, key): return dict.__getitem__(self,str(key)) > > > KeyError: '_tableobj' > > > > any ideas ? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

