Cannot resolve reference error if reading (select()) a table in menue.py...

164 views
Skip to first unread message

icodk

unread,
Jan 18, 2017, 11:59:20 PM1/18/17
to web2py-users
In general I can have a reference in table child to table parent  disregarding the definition order. 
However, If I read from  table child (that reference table parent)  in menu.py, I get a Cannot resolve reference error 
Any idea how to solve it ?

Anthony

unread,
Jan 19, 2017, 6:40:01 AM1/19/17
to web2py-users
Please show some code and a full traceback.

icodk

unread,
Jan 19, 2017, 9:42:29 AM1/19/17
to web2py-users
Anthony
Attached a complete welcome application that demonstrate the problem
Just register and you should get the error
There are two tables of interest org table in db.py and  shop table in tables.py
the org table has a reference to the shop table  and there is a select() on the org table in menu.py that I think triggers the error
Thanks for helping me
welcome.zip

Anthony

unread,
Jan 19, 2017, 1:51:25 PM1/19/17
to web2py-users
On Thursday, January 19, 2017 at 9:42:29 AM UTC-5, icodk wrote:
Anthony
Attached a complete welcome application that demonstrate the problem
Just register and you should get the error
There are two tables of interest org table in db.py and  shop table in tables.py
the org table has a reference to the shop table  and there is a select() on the org table in menu.py that I think triggers the error

Well, without looking at the code, I assume the problem is that you are attempting a query in menu.py that involves a table definition in tables.py. Note that model files are executed in alphabetical order, so when menu.py is executed, tables.py has not yet executed.

Anthony

icodk

unread,
Jan 19, 2017, 2:44:09 PM1/19/17
to web2py-users
Yes you are right.
I renamed the second file so it will be pared before menu.py so now it works
Thanks
Reply all
Reply to author
Forward
0 new messages