You are probably better off using the onaccept callback, which could do its
own redirect and/or set a session flag.
Anthony
On Sunday, April 9, 2017 at 5:22:02 PM UTC-4, Alfonso Serra wrote:
>
> Ok its sorted but i had to change tools.py to remove the redirection, line
> 3978 like:
>
> if form.accepts(request, session,
> formname='change_password',
> onvalidation=onvalidation,
> hideerror=self.settings.hideerror):
>
> current_user = s.select(limitby=(0, 1), orderby_on_limitby=
> False).first()
> if not form.vars['old_password'] == current_user[passfield]:
> form.errors['old_password'] = self.messages.
> invalid_password
> else:
> d = {passfield: str(form.vars.new_password)}
> s.update(**d)
> session.flash = self.messages.password_changed
> self.log_event(log, self.user)
> callback(onaccept, form)
> if next:
> next = replace_id(next, form)
> redirect(next, client_side=self.settings.client_side)
> # if not next:
> # next = self.url(args=request.args)
> # else:
> # next = replace_id(next, form)
> return form
>
> This way, redirection is optional and the form will preserve
> "form.accepted" and "form.errors" so im able to implement the view.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.