是否有相当于Rails的“flash” GAE(python)中的消息? [英] Is there an equivalent to Rails’ "flash" messages in GAE (python)?
问题描述
Ruby on Rails有一种方法可以设置消息,如 flash [:notice]
和 flash [:error
,用户将看到下一个机会。这对于通知用户登录失败等情况特别有用,当他们被重定向时(例如回到登录页面)。
有没有在Google App Engine(Python API)上实现此规范或常用方法? (假设Django未被使用)。
我喜欢llazzaro关于模板的建议。
li>
如果您正在处理会话,请将该消息粘贴到会话中。
Cookie 警告: 无论如何,当您显示Flash消息时,请立即清除会话或Cookie中的消息。 Ruby on Rails has a way that you can set a message, like Is there a canonical or common way to achieve this on Google App Engine (Python API)? (Assume Django is not being used.) I like llazzaro's advice regarding templates. The other half to the story is being able to maintain the flash message between requests. If you are dealing with sessions, stick the message in the session. If you don't have session support, you'll have to create use a cookie. Cookie caveats: Regardless, when you display flash messages, immediately clear the message from the session or cookie. 这篇关于是否有相当于Rails的“flash” GAE(python)中的消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
flash[:notice]
and flash[:error
, that the user will see at the next opportunity. It’s especially useful for things like notifying the user of failure to log in, etc., when they are redirected (e.g. back to a sign-in page).