Broken backwards compatibility: Using a field in multiple tables yields error

31 views
Skip to first unread message

Jordan Myers

unread,
Sep 25, 2017, 12:38:51 PM9/25/17
to web2py-users
I have many tables that share common attributes, so for convenience and ease of refactoring, I decided to define such common fields and then simply reference those fields when defining tables. For example:

namefield = Field("name")
db.define_table('table1', namefield)
db.define_table('table2', namefield)


This works correctly on 2.14.6 but somewhere along the way to version 2.15.4 something changed such that the above code yields the error "Field table1.name is already bound to a table" This is probably due to upgrading to a new PyDAL version. It looks like I'll have to refactor to use table inheritance or the .clone() method. Just leaving this here in case others find the same error.

Massimo Di Pierro

unread,
Sep 30, 2017, 7:39:25 PM9/30/17
to web2py-users
Thanks for reporting this. We will fix this in 2.15.5 shortly.
Reply all
Reply to author
Forward
0 new messages