Clone this wiki locally
You can add flash messages with:
And retrieve them with:
… which also clears any messages in there before returning them. It returns a list of 3-tuples,
(message, args, kwargs), so they can be passed on to the translation function.
I’ve added code to the skeleton’s
site.mak to display flash messages above the main content body.
The suggested way to use Flash messages is to give translation keys (see Translation) rather than English. If the message has interpolated parts, you can give values for them to
addFlashMessage, and they will be passed into the translator at rendering time. For example:
request.session.addFlashMessage("cart:itemAdded", itemName=item.name, quantity=3)
Flash messages are transient: They won’t survive server restarts (or calls to
store.reset(), which you probably shouldn’t be calling anyway).
I’ve added flash messages for login failure (one for missing un or pw, another for incorrect), and English translations for them in Warp’s internal translation table.