This may be a bug. Will look into it...

On Apr 8, 2:31 am, Jens Örtenholm <[email protected]> wrote:
> Hello everyone,
>
> I believe I've found a bug in SQLFORM.accepts.
>
> When calling with an onvalidation function as:
>
> form = SQLFORM(db.table)
> if form.accepts(request.vars, session, onvalidation=function):
>
> And the function sets an error:
>
> def function(form):
>     form.errors.myfield = 'This is an error'
>
> The form is still accepted, DB is inserted or updated with the record.
>
> As far as I can tell from looking at the code in SQLFORM.accepts, the case
> where ret value is False because of form.errors not being empty is not
> handled anywhere.
>
> Tested on 1.94.6
>
> //Jens

Reply via email to