diff options
author | Caleb Forbes Davis V <caldavis@gmail.com> | 2011-06-27 13:13:52 -0500 |
---|---|---|
committer | Caleb Forbes Davis V <caldavis@gmail.com> | 2011-06-27 13:25:55 -0500 |
commit | 2264670357754ae546ed69e3c825da8860b372aa (patch) | |
tree | b34bc9faa40c0ac70a1299a7bc23853f270efa35 /mediagoblin/util.py | |
parent | e1d9e1d139a81d4d7592d349e3594d3a9d21c285 (diff) | |
download | mediagoblin-2264670357754ae546ed69e3c825da8860b372aa.tar.lz mediagoblin-2264670357754ae546ed69e3c825da8860b372aa.tar.xz mediagoblin-2264670357754ae546ed69e3c825da8860b372aa.zip |
adds message queue
Feature #368 - messaging framework
* message levels are debug, info, success, warning, and error
* display mechanism - base.html includes messages.html for now
* fetch_messages and add_message are available to all templates
using jinja2 environment.globals
* messages are displayed and cleared. no persistence
Diffstat (limited to 'mediagoblin/util.py')
-rw-r--r-- | mediagoblin/util.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mediagoblin/util.py b/mediagoblin/util.py index 91fbee0a..f0229300 100644 --- a/mediagoblin/util.py +++ b/mediagoblin/util.py @@ -32,6 +32,7 @@ from lxml.html.clean import Cleaner import markdown from mediagoblin import mg_globals +from mediagoblin import messages from mediagoblin.db.util import ObjectId TESTS_ENABLED = False @@ -104,6 +105,12 @@ def get_jinja_env(template_loader, locale): mg_globals.translations.gettext, mg_globals.translations.ngettext) + # All templates will know how to ... + # ... add a new message to the message queue + template_env.globals['add_message'] = messages.add_message + # ... fetch all waiting messages and remove them from the queue + template_env.globals['fetch_messages'] = messages.fetch_messages + if exists(locale): SETUP_JINJA_ENVS[locale] = template_env |