skip to navigation
skip to content

Not Logged In

bottle-flash 0.1

flash plugin for bottle

bottle_flash
============

This plugin enables flash messages in bottle. Again, learn by example

::

from bottle import Bottle
from bottle_flash import FlashPlugin

app = Bottle()
COOKIE_SECRET = 'super_secret_string'
app.install(FlashPlugin(secret=COOKIE_SECRET))

app.post('/create_user')
def create_user():
# Create the user
app.flash('Created !')

To consume the flashed messages, you would do something like the following (jinja2). Here I am assuming that I get the "app" in the template context. This can be achieved with the bottle_renderer_ plugin.

::

{% set messages = app.get_flashed_messages() %}
{% if messages %}


    {% for m in messages %}
  • {{ m[0] }}

  • {% endfor %}


{% endif %}  
File Type Py Version Uploaded on Size
bottle-flash-0.1.tar.gz (md5) Source 2011-09-16 1KB
  • Downloads (All Versions):
  • 3 downloads in the last day
  • 20 downloads in the last week
  • 80 downloads in the last month