aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorArmin Ronacher <armin.ronacher@active-4.com>2009-09-10 13:58:52 -0700
committerArmin Ronacher <armin.ronacher@active-4.com>2009-09-10 13:58:52 -0700
commitb4da9bee751d1edbb636f972e2e2fbb6bfbedec3 (patch)
treeb6c84683516bea586fb876b405be753563593b90 /examples
parentbd3577237d2502158cc5725d3aa79d7643f033df (diff)
downloadjinja-b4da9bee751d1edbb636f972e2e2fbb6bfbedec3.tar.gz
Added tornado templates to benchmark.
--HG-- branch : trunk
Diffstat (limited to 'examples')
-rw-r--r--examples/bench.py44
1 files changed, 43 insertions, 1 deletions
diff --git a/examples/bench.py b/examples/bench.py
index 49b1c752..0d5a68fe 100644
--- a/examples/bench.py
+++ b/examples/bench.py
@@ -55,6 +55,48 @@ def test_jinja():
jinja_template.render(context)
try:
+ from tornado.template import Template
+except ImportError:
+ test_tornado = None
+else:
+ tornado_template = Template("""\
+<!doctype html>
+<html>
+ <head>
+ <title>{{ page_title }}</title>
+ </head>
+ <body>
+ <div class="header">
+ <h1>{{ page_title }}</h1>
+ </div>
+ <ul class="navigation">
+ {% for href, caption in [ \
+ ('index.html', 'Index'), \
+ ('downloads.html', 'Downloads'), \
+ ('products.html', 'Products') \
+ ] %}
+ <li><a href="{{ href }}">{{ caption }}</a></li>
+ {% end %}
+ </ul>
+ <div class="table">
+ <table>
+ {% for row in table %}
+ <tr>
+ {% for cell in row %}
+ <td>{{ cell }}</td>
+ {% end %}
+ </tr>
+ {% end %}
+ </table>
+ </div>
+ </body>
+</html>\
+""")
+
+ def test_tornado():
+ tornado_template.generate(**context)
+
+try:
from django.conf import settings
settings.configure()
from django.template import Template as DjangoTemplate, Context as DjangoContext
@@ -300,7 +342,7 @@ sys.stdout.write('\r' + '\n'.join((
)) + '\n')
-for test in 'jinja', 'mako', 'tenjin', 'spitfire', 'django', 'genshi', 'cheetah':
+for test in 'jinja', 'mako', 'tornado', 'tenjin', 'spitfire', 'django', 'genshi', 'cheetah':
if locals()['test_' + test] is None:
sys.stdout.write(' %-20s*not installed*\n' % test)
continue