Yes, it does work. Thanks very much. I was not aware session.flash was internally managed.
session.flash can be overridden def test1(): session.flash='redirect from test1()' session.msg1='overriding session.flash from test1()' redirect(URL(r=request, f='test2')) def test2(): if session.msg1: response.flash=session.msg1 del session.msg1 return dict() John Heenan On Sep 16, 11:34 am, "mr.freeze" <nat...@freezable.com> wrote: > Session.flash is automatically copied to response.flash after > redirection so you shouldn't need to do anything. Does this work?: > > def test1(): > session.flash='redirect from test1()' > redirect(URL(r=request, f='test2')) > > def test2(): > return dict() > > On Sep 15, 8:24 pm, John Heenan <johnmhee...@gmail.com> wrote: > > > If I do an internal redirect within a web2y site, such as > > thoughhttp://www.example.com/app/default/test1below, then changes to the > > session are not saved. > > > The flash message on redirect to test2 is 'session.flash is empty' > > instead of 'redirect from test1()'. > > > Is there something I can do to change this or is there a convenient > > workaround? > > > Saving the flash message using code in a module is hardly thread safe. > > Besides it did not work. > > > Thanks > > > John Heenan > > > sample controller code: > > > def test1(): > > session.flash='redirect from test1()' > > redirect(URL(r=request, f='test2')) > > > def test2(): > > response.flash= session.flash if session.flash else 'session.flash > > is empty' > > del session.flash > > return dict() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---