After changes in the database, like submiting a form, if you're not
"ajaxing things up!", is good practice to redirect the user to some
page. This avoids the problem where the refresh button from the
browser would re-submit the form and stuff like that. If you can't
send flash messages after a redirect, you can't use the good practice
behavior "by default". For the users i know, that redirect is pretty
much a life savior, and they never know what happened without a nice
message after the submit.

On 16 abr, 01:53, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I think that storing messages in the database is overkill and storing
> them in cookies is unsafe (unless we encrypt cookies and that is also
> overkill) and would not work when cookies are off.
>
> What is so bad about the current way of doing it?
>
> Massimo
>
> On Apr 15, 10:21 pm, Italo Maia <italo.m...@gmail.com> wrote:
>
> > In django, they use a messaging system based in the database, and
> > relate messages from the user with his session. When the message is
> > fetched to the user, it is then removed immediatly. That makes it
> > possible for redirects to show messages for an user after a redirect,
> > tought it does not work for non-authenticated users. Maybe if you
> > could relate messages in the database to the user ip if he is not
> > logged, and to his session, if he is logged...that could do the
> > trick.
>
> > For what i understand, you can't flash messages to an user after a
> > redirect because the flash message get's stored in the response for
> > the original request. After a redirect, a new request is made, and a
> > new response is created, so, the application has no way to remember
> > that a flash message was generated.
>
> > Another way to store "flash" messages could be storing them in a
> > cookie before the redirect, and erase them after reading them.
> > Probably not a safe choice for some systems, and if cookies is turned
> > off in the browser, the messages would get lost.
>
> > There's one more way that i can think of. You could, in the redirect,
> > specify a GET parameter like: &message_status=1. That could do the
> > trick, nice and dirty, tough you would have to filter messages
> > depending on user previlegies or something.
>
> > On 15 abr, 21:07, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Because I cannot find a way to make it work. I do not believe it is
> > > possible. I may be wrong and if you find a way send me a patch.
>
> > > Massimo
>
> > > On Apr 15, 6:38 pm, ceej <cjlaz...@googlemail.com> wrote:
>
> > > > Is there a reason response.flash doesn't work with redirect('/') ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to