Skip to main content

flash plugin for bottle

Project description

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 %}
<div id="flash_messages">
<ul>
{% for m in messages %}
<li>{{ m[0] }}</li>
{% endfor %}
</ul>
</div>
{% endif %}

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for bottle-flash, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size bottle-flash-0.1.tar.gz (1.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page