What do you mean it isn't working? What do you expect, and what is
happening instead? How are you calling order_callback()? Is this an Ajax
request? Can we see the code?
On Tuesday, February 19, 2013 8:42:43 PM UTC-5, 黄祥 wrote:
>
> hi,
>
> i just create a callback function after it done, it will redirect to
> another page, it seems, that the redirect function is not working.
>
> for example :
> def order_callback():
> id=int(request.vars.id)
> if request.vars.action=='add':
> session.order[id]=session.order.get(id, 0)+1
> if request.vars.action=='subtract':
> session.order[id]=max(0,session.order.get(id, 0)-1)
> * if request.vars.action=='remove':*
> * del session.order[id]*
> * redirect(URL('order'))*
> * if request.vars.action=='reset':*
> * session.order.clear()*
> * redirect(URL('product'))*
> return str(session.order[id])
>
> the bold text for redirect function is not work, only the first command is
> executed *del session.order[id] & **session.order.clear().*
> i solve it by creating another definition function like :
> def order_reset():
> session.order.clear()
> redirect(URL('product'))
> return locals()
>
> my question is :
> is there anyway to do that (redirect) just using callback?
>
> thank you very much before
>
--
---
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/groups/opt_out.