I tried from the shell and I cannot reproduce it: $ python web2py.py -S welcome -N web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2012 Version 2.0.9 (2012-09-29 17:16:28) dev Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), MongoDB(pymongo), IMAP(imaplib) WARNING:web2py:import IPython error; use default python shell Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> db =DAL(lazy_tables = True) >>> db.define_table('x', ... Field('name', 'string') ... ) >>> >>> db.define_table('y', ... Field('x', 'reference x'), ... Field('age', 'integer', default = 30) ... ) >>> >>> x_id = db.x.insert(name = 'barry') >>> db.y.insert(x = x_id, age = 99) 1 >>> x = db(db.x.id > 0).select().first() >>> import logging >>> for y in x.y.select(): logging.info(y) ... >>>
On Saturday, 29 September 2012 17:09:12 UTC-5, Matt wrote: > > Any luck reproducing this? > > I can consistently make this bug happen by firstly launching my app via > the app engine launcher with Lazy_tables = False. > > Then whilst it's running switch it over to Lazy_tables = True. > > Matt > > On Sunday, September 16, 2012 8:34:46 AM UTC+12, Massimo Di Pierro wrote: >> >> No. I will asap. >> >> On Friday, 14 September 2012 23:00:10 UTC-5, Matt wrote: >>> >>> Weird. Did you try with GAE? >>> >>> Matt >>> >>> On Saturday, September 15, 2012 2:20:57 PM UTC+12, Massimo Di Pierro >>> wrote: >>>> >>>> I cannot reproduce this. tested with and without lazy_tables = True on >>>> 2.0.9. >>>> >>>> On Friday, 14 September 2012 20:19:48 UTC-5, Matt wrote: >>>>> >>>>> Hi there, >>>>> >>>>> I've noticed that the new lazy_tables option is causing problems. >>>>> >>>>> if I do the following (at least on GAE and Cloud SQL): >>>>> >>>>> setting dal(lazy_tables = True) >>>>> >>>>> db.define_table('x', >>>>> Field('name', 'string') >>>>> ) >>>>> >>>>> db.define_table('y', >>>>> Field('x', 'reference x'), >>>>> Field('age', 'integer', default = 30) >>>>> ) >>>>> >>>>> x_id = db.x.insert(name = 'barry') >>>>> db.y.insert(x = x_id, age = 99) >>>>> >>>>> And then run >>>>> >>>>> def test(): >>>>> x = db(db.x.id > 0).select().first() >>>>> >>>>> for y in x.y.select(): >>>>> logging.info(y) >>>>> >>>>> It fails with the following error: >>>>> >>>>> for y in x.y.select(): >>>>> AttributeError: 'Row' object has no attribute 'y' >>>>> >>>>> If I set lazy_tables back again to False. It's fine again. >>>>> >>>>> Matt >>>>> >>>> --