summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2008-09-20 12:04:53 +0200
committerArmin Ronacher <armin.ronacher@active-4.com>2008-09-20 12:04:53 +0200
commitc347ed0f456ffab654a3621f59b1daeda724977f (patch)
treeace1e1693775017f2d8b66d1f362f4bff95488f0 /examples
parent1b54f7435ba58add1e4ac495688c39ff36fb59eb (diff)
downloadjinja2-c347ed0f456ffab654a3621f59b1daeda724977f.tar.gz
Unified some code in the super/template reference system.
--HG-- branch : trunk
Diffstat (limited to 'examples')
-rw-r--r--examples/bench.py9
-rw-r--r--examples/rwbench/rwbench.py4
2 files changed, 9 insertions, 4 deletions
diff --git a/examples/bench.py b/examples/bench.py
index 8696be0..49b1c75 100644
--- a/examples/bench.py
+++ b/examples/bench.py
@@ -61,7 +61,7 @@ try:
except ImportError:
test_django = None
else:
- django_template = DjangoTemplate("""\
+ django_template = """\
<!doctype html>
<html>
<head>
@@ -89,13 +89,16 @@ else:
</div>
</body>
</html>\
-""")
+"""
def test_django():
c = DjangoContext(context)
c['navigation'] = [('index.html', 'Index'), ('downloads.html', 'Downloads'),
('products.html', 'Products')]
- django_template.render(c)
+ # recompile template each rendering because that's what django
+ # is doing in normal situations too. Django is not thread safe
+ # so we can't cache it in regular apps either.
+ DjangoTemplate(django_template).render(c)
try:
from mako.template import Template as MakoTemplate
diff --git a/examples/rwbench/rwbench.py b/examples/rwbench/rwbench.py
index 1bde056..742e0ea 100644
--- a/examples/rwbench/rwbench.py
+++ b/examples/rwbench/rwbench.py
@@ -78,8 +78,10 @@ def test_mako():
from djangoext import django_loader, DjangoContext
-django_template = django_loader.get_template('index.html')
def test_django():
+ # not cached because django is not thread safe and does
+ # not cache by itself so it would be unfair to cache it here.
+ django_template = django_loader.get_template('index.html')
django_template.render(DjangoContext(context))