Skip to main content

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 )

Project details


Download files

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

Source Distribution

TGPriFlash-0.1.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

TGPriFlash-0.1.2-py2.4.egg (5.6 kB view details)

Uploaded Source

File details

Details for the file TGPriFlash-0.1.2.tar.gz.

File metadata

  • Download URL: TGPriFlash-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for TGPriFlash-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d5e9d78b33763ad9377201763f4a9b4a0ea460044eb738c324a6b55bda676123
MD5 30bfedfd08686599221e635fff88c055
BLAKE2b-256 17dda34e5768ab3d6f703e00ef4e69690c0183b1aa8704ca35f2b76cd541ebed

See more details on using hashes here.

File details

Details for the file TGPriFlash-0.1.2-py2.4.egg.

File metadata

File hashes

Hashes for TGPriFlash-0.1.2-py2.4.egg
Algorithm Hash digest
SHA256 173e9d661081d00190e85b30be8b51f46b56fca3974bffa394d9992f4e6e9d0b
MD5 37c6e0c2fb832e244972b1cf5bddd0a6
BLAKE2b-256 1f61b0762a41fc6ffdba435b1a8f67398d28b544de454c54e3592b9018fd9542

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page