bag.web.flash_msg module¶
FlashMessage is the natural class to store UI notifications.
Because it knows:
the content of a flash message in either plain or rich form(s)
the level (color) of the message, such as info, danger, success etc.
different ways of rendering the message on the page
whatever else you want (you can add instance variables or subclass it).
This can be used in any web framework. We provide integration for Pyramid
in the module bag.web.pyramid.flash_msg
.
FlashMessage is able to render itself with Bootstrap styles.
If you are not using Bootstrap, or if you don’t like that I am
generating HTML in Python, or if you want some additional content or style,
you can still use this class and just render the messages yourself.
You can even override the bootstrap_alert
property in a subclass.
A more useful version of this module is provided by the state.py module of the kerno library.