I should have been ready for this one. Guess I'll just have to work with "onvalidation".
On Apr 11, 12:18 am, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: > sorry you cannot have a join in a validator. > I think this qualifies as an XY problem. ;-) > > Massimo > > On Apr 9, 10:56 am, guruyaya <guruy...@gmail.com> wrote: > > > > > > > > > Take this example > > db.define_table('table1', Field('title)); > > db.define_table('table2',Field('title'),Field('table1_id',db.table1)) > > db.define_table('table3',Field('title'),Field('table2_id',db.table2,'anothe > > r_table2_id',db.table2)); > > > Now I want to write a validator that makes sure Both table2 and > > another_table2 come from the same table1 > > > Now this: > > db.table3.another_table2_id.requires = > > IS_IN_DB(db(db.table2.table1_id.id==db.table3.table2_id.table1.id),db.table > > 2.id) > > > Won't do the job for me. It just throws an error in dal.py, that goes: > > > TypeError: int() argument must be a string or a number, not 'Table' > > > I'm pretty sure I've covered all I know. Can anyone have a brighter > > idea?