No. validators are associated to one field in the sense that only one
field will report the error.
db.define_table('t',SQLField('f1'),SQLField('f'2'))
db.t.f2.requires=IS_NOT_IN_DB(db(db.t.f1==request.vars.f1),'t.f2')
OR
db.t.f1.requires=IS_NOT_IN_DB(db(db.t.f2==request.vars.f2),'t.f1')
are equivalent and do exactly what you ask. except that the former
associates the error with the f1 value and the second to the f2 value.
They both generate the query
db((db.t.f1==request.vars.f1)&(db.t.f2==request.vars.f2)).count()
Massimo
On Dec 12, 4:01 pm, DenesL <[email protected]> wrote:
> On Dec 12, 4:07 pm, mdipierro <[email protected]> wrote:
>
> > I still do not see why you cannot use IS_NOT_IN_DB(sqlset,....) You
> > must have access to the variables that you want to validate.
>
> Correct me if I am wrong but IS_NOT_IN_DB only looks at the value of
> one field.
> From validators.py:
> rows=self.dbset(field=value).select(limitby=(0,1))
>
> What we are thinking is:
> [field1value,field2value,field3value,...] as a row is not in the DB.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---