comparison examples/bench/basic.py @ 103:0f246a30d3a7 trunk

benchmark: improved functionality of SimpleTAL example. Thanks to bruno desthuilliers for some tips.
author cmlenz
date Wed, 26 Jul 2006 08:50:09 +0000
parents ff19219485cc
children c77c113846d6
comparison
equal deleted inserted replaced
102:e20a153cc20c 103:0f246a30d3a7
106 fileobj.close() 106 fileobj.close()
107 fileobj = open(os.path.join(dirname, 'template.html')) 107 fileobj = open(os.path.join(dirname, 'template.html'))
108 template = simpleTAL.compileHTMLTemplate(fileobj) 108 template = simpleTAL.compileHTMLTemplate(fileobj)
109 fileobj.close() 109 fileobj.close()
110 def render(): 110 def render():
111 ctxt = simpleTALES.Context() 111 ctxt = simpleTALES.Context(allowPythonPath=1)
112 ctxt.addGlobal('base', base) 112 ctxt.addGlobal('base', base)
113 ctxt.addGlobal('title', 'Just a test') 113 ctxt.addGlobal('title', 'Just a test')
114 ctxt.addGlobal('user', 'joe') 114 ctxt.addGlobal('user', 'joe')
115 ctxt.addGlobal('items', ['Number %d' % num for num in range(1, 15)]) 115 ctxt.addGlobal('items', ['Number %d' % num for num in range(1, 15)])
116 buf = StringIO() 116 buf = StringIO()
Copyright (C) 2012-2017 Edgewall Software