Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A TurboGears flash implementation that supports multiple priority levels.

Project Description

TGPriFlash is a TurboGears flash implementation that supports multiple priority levels.

Install

Install with setuptools:

$ easy_install TGPriFlash

or download from http://pypi.python.org/pypi/TGPriFlash

Usage

Out of the box, 3 levels are defined (FLASH_INFO, FLASH_WARNING, FLASH_ALERT) but you can ignore these and use any integer values you like as the flash priority levels.

To “magically” replace (aka monkey patch) turbogears.flash() with this one, just add this import to your start-project.py:

import tg_pri_flash.flash

Within your project you can import turbogears.flash as normal:

from turbogears import flash

You’ll want to replace the tg_flash line in your master template:

<div py:if="tg_flash" class="flash" py:content="tg_flash"></div>

with something like this:

<div py:if="tg_flash and tg_flash[1]==0" class="flash_ok" py:content="tg_flash[0]"></div>
<div py:if="tg_flash and tg_flash[1]==1" class="flash_warning" py:content="tg_flash[0]"></div>
<div py:if="tg_flash and tg_flash[1]==2" class="flash_alert" py:content="tg_flash[0]"></div>

You would then define CSS definitions for each of the classes.

In your controller you can call flash() with a second argument, a positive integer:

flash( _(u"There was an error"), 2 )

or, using the built-in constants:

from tg_pri_flash.flash import FLASH_ALERT
flash( _(u"There was an error"), FLASH_ALERT )
Release History

Release History

This version
History Node

0.1.2

History Node

0.1.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
TGPriFlash-0.1.2-py2.4.egg (5.6 kB) Copy SHA256 Checksum SHA256 2.4 Egg Aug 1, 2008
TGPriFlash-0.1.2.tar.gz (6.7 kB) Copy SHA256 Checksum SHA256 Source Aug 1, 2008

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting