Thank you Massimo,

I have tried it but nothing seems to have changed.

Here is what I have:

-----
def firstpage():
    return dict()

def secondpage():
    session.flash=response.flash
    session.flash=T('You cannot view the secondpage, you are back to
the firstpage!')
    redirect(URL(r=request,f='firstpage'))
    return dict()

and in firstpage.html:

{{=A('Link to secondpage',_href=URL(r=request,f='secondpage'))}}

-----

The flash message is not displeayed though.
But if I change the redirect to another page, let us say 'pagethree',
then the flash message is displayed when 'pagethree' is displayed..

Aurelien

On Feb 18, 3:21 pm, mdipierro <[email protected]> wrote:
> Usually this problem is caused by double redirect. Try add
>
> session.flash=response.flash
>
> at the top of your controller. This will carry forward the flash. You
> do not want this in production but will help you identify the problem.
>
> On Feb 18, 7:20 am, aure <[email protected]> wrote:
>
> > I just figured out that it only happens if I do a redirect to the page
> > from which the controller was called.
>
> > It happens like this:
> > - A link on a page "home" is clicked to access a page "book" but in
> > the "book" controller because some conditions are not met, I set a
> > message using session.flash('message') and do a redirect to "home". It
> > goes to "home" but no message is displayed.
>
> > On the other hand, if the redirect is set to a page different from
> > "home", then the message is displayed.
>
> > What should I do? Is the redirect not appropriate in the case we go
> > back to the calling page?
>
> > Aurelien
>
> > On Feb 18, 1:54 pm, aure <[email protected]> wrote:
>
> > > Hi everyone,
>
> > > Does someone have an idea about why session.flash might stop to work
> > > (is not displayed) for my controllers but keeps on working for login,
> > > logout,...
>
> > > Thank you,
> > > Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to