Why are you explicitly calling form.accepts -- crud.create and crud.update
already call form.accepts themselves?
On Tuesday, May 31, 2011 2:51:42 PM UTC-7, selecta wrote:
> def edit():
> record_id = request.args(0)
> def on_accept(form):
> print 'in on accept'
> response.headers['web2py-component-command'] =
> XML("web2py_component('%s','list')"%URL('list'))
> if not record_id:
> db.plugin_whishlist.open.readable,
> db.plugin_whishlist.open.writable = False, False
> form = crud.create(db.plugin_whishlist, onaccept = on_accept)
> else:
> form = crud.update(db.plugin_whishlist, record_id,
> onaccept = on_accept)
> if form.accepts(request.vars, session):
> print 'in this on accept ', form.vars.id
> response.headers['web2py-component-command'] =
> XML("web2py_component('%s','list')"%URL('list'))
> return ''
> return form
>
> if the form is accepted it will print
> "in this on accept" that means it uses form.accepts instead of the
> function that is passed.
> is this behavior expected? it confused me a bit