Mind if you have a double redirect before redirection, you can tell web2py 
to carry on any flash message:

    session.flash = response.flash

Perhaps this should be done automatically by the redirect function.


On Sunday, 13 October 2013 09:12:42 UTC-5, lesssugar wrote:
>
> Thank you, Massimo, it's all clear now.
>
> On Sunday, October 13, 2013 4:10:50 PM UTC+2, Massimo Di Pierro wrote:
>>
>> The redirecting page sets session.flash. After redirection this gets 
>> copied into response.flash and displayed by the default layout, unless 
>> somewhere in the logic there is something that sets session.flash=None 
>> before redirection or response.flash=None after redirection. Double 
>> redirection may also cause the flash to disappear.
>>
>> On Sunday, 13 October 2013 08:42:49 UTC-5, lesssugar wrote:
>>>
>>> You're right. When I changed the page to redirect after password change 
>>> - the "Password changed" flash shows up.
>>>
>>> I don't quite understand what do you mean by overriding response.flash. 
>>> Does it mean you assume that the previous redirect-page had a flash 
>>> displayed onload?
>>>
>>> On Sunday, October 13, 2013 2:43:51 PM UTC+2, Massimo Di Pierro wrote:
>>>>
>>>> If you look into gluon/tools.py 
>>>> there is this line:
>>>>
>>>> session.flash = self.messages.password_changed
>>>>
>>>> So there is a flash after password changed. perhaps you redirect to a 
>>>> page that overrides response.flash?
>>>>
>>>> On Saturday, 12 October 2013 16:23:44 UTC-5, lesssugar wrote:
>>>>>
>>>>> I'm using auth.change_password() in my profile Settings section. The 
>>>>> code responsible for the form:
>>>>>
>>>>> change_password = auth.change_password(next=URL('profile', 'settings'))
>>>>> change_password.update(_class='formstyle', _name='change_password')
>>>>>
>>>>> return dict(change_password=change_password)
>>>>>
>>>>>
>>>>> The form works, the input is processed, the password gets changed. 
>>>>> However there's no flash message after submitting the form. I guess, as 
>>>>> change_password() is a build-in function, there should be a default flash 
>>>>> message.
>>>>>
>>>>> I tried adding this (below), and it also doesn't work:
>>>>>
>>>>> if change_password.accepted:
>>>>>     response.flash = "Password changed"
>>>>>
>>>>> Any ideas?
>>>>>
>>>>>
>>>>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to