Edgewall Software

Ticket #23: django-bigtable.diff

File django-bigtable.diff, 1.2 KB (added by Simon Willison, 9 years ago)

Patch to add Django to the bigtable.py benchmark

  • bigtable.py

     
    1818import neo_cs
    1919import neo_util
    2020
     21from django.template import Template as DjangoTemplate, Context as DjangoContext
     22
    2123table = [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10)
    2224          for x in range(1000)]
    2325
     
    4547<html xmlns:py="http://purl.org/kid/ns#">$table</html>
    4648""")
    4749
     50django_tmpl = DjangoTemplate("""
     51<table>
     52{% for row in table %}
     53<tr>{% for col in row.values %}{{ col }}{% endfor %}</tr>
     54{% endfor %}
     55</table>
     56""")
    4857
     58def test_django():
     59    """Djange template"""
     60    context = DjangoContext({'table': table})
     61    django_tmpl.render(context)
     62
    4963def test_markup():
    5064    """Markup template"""
    5165    ctxt = Context(table=table)
     
    125139
    126140def run(which=None, number=10):
    127141    tests = ['test_builder', 'test_markup', 'test_markup_builder', 'test_kid',
    128              'test_kid_et', 'test_et', 'test_cet', 'test_clearsilver']
     142             'test_kid_et', 'test_et', 'test_cet', 'test_clearsilver',
     143             'test_django']
    129144    if which:
    130145        tests = filter(lambda n: n[5:] in which, tests)
    131146