Changeset 652
- Timestamp:
- Jun 28, 2007, 8:12:15 PM (16 years ago)
- Location:
- trunk/examples/bench
- Files:
-
- 3 edited
-
bigtable.py (modified) (3 diffs)
-
mako/header.html (modified) (1 diff)
-
mako/template.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/bench/bigtable.py
r587 r652 42 42 43 43 try: 44 from m yghty.interp import Interpreter as MyghtyInterpreter45 except ImportError: 46 M yghtyInterpreter= None44 from mako.template import Template as MakoTemplate 45 except ImportError: 46 MakoTemplate = None 47 47 48 48 table = [dict(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8,i=9,j=10) … … 75 75 django_tmpl.render(context) 76 76 77 if MyghtyInterpreter: 78 interpreter = MyghtyInterpreter() 79 component = interpreter.make_component(""" 77 if MakoTemplate: 78 mako_tmpl = MakoTemplate(""" 80 79 <table> 81 % for row in ARGS['table']:82 <tr>83 %for col in row.values():84 <td><% col %></td>85 % 86 % 87 </tr>80 % for row in table: 81 <tr> 82 % for col in row.values(): 83 <td>${ col | h }</td> 84 % endfor 85 </tr> 86 % endfor 88 87 </table> 89 88 """) 90 def test_myghty(): 91 """Myghty Template""" 92 buf = StringIO() 93 interpreter.execute(component, request_args={'table':table}, out_buffer=buf) 89 def test_mako(): 90 """Mako Template""" 91 mako_tmpl.render(table=table) 94 92 95 93 def test_genshi(): … … 187 185 def run(which=None, number=10): 188 186 tests = ['test_builder', 'test_genshi', 'test_genshi_builder', 189 'test_m yghty', 'test_kid', 'test_kid_et', 'test_et', 'test_cet',187 'test_mako', 'test_kid', 'test_kid_et', 'test_et', 'test_cet', 190 188 'test_clearsilver', 'test_django'] 191 189 -
trunk/examples/bench/mako/header.html
r648 r652 1 1 <div id="header"> 2 <h1>${title }</h1>2 <h1>${title | h}</h1> 3 3 </div> 4 4 -
trunk/examples/bench/mako/template.html
r648 r652 8 8 <body> 9 9 <%def name="greeting(name)"> 10 <p>Hello, ${name }!</p>10 <p>Hello, ${name | h}!</p> 11 11 </%def> 12 12 … … 21 21 <ul> 22 22 % for idx, item in enumerate(items): 23 <li ${idx+1==len(items) and "class='last'" or ""}>${item }</li>23 <li ${idx+1==len(items) and "class='last'" or ""}>${item | h}</li> 24 24 % endfor 25 25 </ul>
Note: See TracChangeset
for help on using the changeset viewer.
