aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tools/template.py
diff options
context:
space:
mode:
Diffstat (limited to 'mediagoblin/tools/template.py')
-rw-r--r--mediagoblin/tools/template.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mediagoblin/tools/template.py b/mediagoblin/tools/template.py
index a773ca99..905a36df 100644
--- a/mediagoblin/tools/template.py
+++ b/mediagoblin/tools/template.py
@@ -17,18 +17,19 @@
from math import ceil
import jinja2
from babel.localedata import exists
-from babel.support import LazyProxy
from mediagoblin import mg_globals
from mediagoblin import messages
from mediagoblin.tools import common
from mediagoblin.tools.translate import setup_gettext
from mediagoblin.middleware.csrf import render_csrf_form_token
+
SETUP_JINJA_ENVS = {}
+
def get_jinja_env(template_loader, locale):
"""
- Set up the Jinja environment,
+ Set up the Jinja environment,
(In the future we may have another system for providing theming;
for now this is good enough.)
@@ -60,6 +61,7 @@ def get_jinja_env(template_loader, locale):
return template_env
+
# We'll store context information here when doing unit tests
TEMPLATE_TEST_CONTEXT = {}
@@ -76,8 +78,8 @@ def render_template(request, template_path, context):
context['request'] = request
context['csrf_token'] = render_csrf_form_token(request)
rendered = template.render(context)
-
- if common.TESTS_ENABLED:
+
+ if common.TESTS_ENABLED:
TEMPLATE_TEST_CONTEXT[template_path] = context
return rendered
@@ -87,6 +89,7 @@ def clear_test_template_context():
global TEMPLATE_TEST_CONTEXT
TEMPLATE_TEST_CONTEXT = {}
+
def gridify_list(this_list, num_cols=5):
"""
Generates a list of lists where each sub-list's length depends on