Sorry I was stupid. You are right. This is a bug.

On Aug 11, 12:04 pm, mdipierro <[email protected]> wrote:
> yes because you should try check if the data is in db before checking
> if it is an int.
>
> On Aug 11, 10:56 am, ionel <[email protected]> wrote:
>
> > Hello,
>
> > Web2py generates an error for:
>
> > db.person.importance.requires=[IS_INT_IN_RANGE(1,999),
> > IS_NOT_IN_DB(db, 'person.importance')]
>
> > but not if I change the order of the two validators:
>
> > db.person.importance.requires=[IS_NOT_IN_DB(db, 'person.importance'),
> > IS_INT_IN_RANGE(1,999)]
>
> > Traceback:
>
> > File "d:\dev\proj\python\web2py\gluon\validators.py", line 486, in
> > __call__
> >     if not value.strip():
> > AttributeError: 'int' object has no attribute 'strip'
>
> > ______
>
> >  Function argument list: (self=<gluon.validators.IS_NOT_IN_DB object>,
> > value=1)
>
> >     def set_self_id(self, id):
> >         self.record_id = id
>
> >     def __call__(self, value):
> >         if not value.strip():
> >             return (value, self.error_message)
> >         if value in self.allowed_override:
> >             return (value, None)
> >         (tablename, fieldname) = str(self.field).split('.')
>
> >     * value.strip: undefined
> >     * value: 1
>
> > i.a.

Reply via email to