Hi Massimo

After upgrading to 1.94.5 it works perfectly.
Thank you very much!

Is there anywhere some documentation regarding request.restful()
besides your video and the thread here on Google groups?
Great stuff!

Regards,
Marcel





On 20 Mrz., 15:20, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> This:
>
> @service.jsonrpc
> def update(record):
>     errors = validate(db.mytable, record)
>     if errors:
>         return dict(success=False, msg=', '.join(errors))
>     else:
>         db(db.mytable.id == record.id).update(record)
>         return dict(success=True)
>
> should be
>
> @request.restful()
> def update:
>     def PUT(id,**record):
>        errors = db.mytbale._validate(**record).values()
>        if errors:
>            return dict(success=False, msg=', '.join(errors))
>        else:
>            db(db.mytable.id == id).update(**record)
>            return dict(success=True)
>     return locals()
>
> and call it with a PUT method at URL:
>
> /.../<record id>?field=value
>
> Massimo
>
> On Mar 20, 3:56 am, Marcel Luethi <marcel.lue...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi all
>
> > I'm looking for a way to validate the record data I receive from a
> > webservice.
> > Because there is no form associated it seems that I cannot use SQLFORM
> > and form.accepts().
>
> > Is there any other way to use the already defined validators to do the
> > check?
>
> > I'm searching for something like (untested):
>
> > @service.jsonrpc
> > def update(record):
> >     errors = validate(db.mytable, record)
> >     if errors:
> >         return dict(success=False, msg=', '.join(errors))
> >     else:
> >         db(db.mytable.id == record.id).update(record)
> >         return dict(success=True)
>
> > TIA - Marcel

Reply via email to