Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added tornado templates to benchmark.

--HG--
branch : trunk
  • Loading branch information...
commit b4da9bee751d1edbb636f972e2e2fbb6bfbedec3 1 parent bd35772
@mitsuhiko authored
Showing with 43 additions and 1 deletion.
  1. +43 −1 examples/bench.py
View
44 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 @@ def test_spitfire():
)) + '\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

0 comments on commit b4da9be

Please sign in to comment.
Something went wrong with that request. Please try again.