Mercurial > genshi > mirror
diff examples/basic/run.py @ 17:74cc70129d04 trunk
Refactoring to address #6: all match templates are now processed by a single filter, which means that match templates added by included templates are properly applied. A side effect of this refactoring is that `Context` objects may not be reused across multiple template processing runs.
Also, output filters are now applied in the `Stream.serialize()` method instead of by the `Template.generate()` method, which just makes more sense.
author | cmlenz |
---|---|
date | Sun, 18 Jun 2006 22:33:33 +0000 |
parents | 518a8520a6e1 |
children | b4d17897d053 |
line wrap: on
line diff
--- a/examples/basic/run.py +++ b/examples/basic/run.py @@ -17,16 +17,16 @@ tmpl = loader.load('test.html') print ' --> parse stage: ', datetime.now() - start - ctxt = Context(hello='<world>', skin='default', hey='ZYX', bozz=None, - items=['Number %d' % num for num in range(1, 15)], - prefix='#') + data = dict(hello='<world>', skin='default', hey='ZYX', bozz=None, + items=['Number %d' % num for num in range(1, 15)], + prefix='#') - print tmpl.generate(ctxt).render(method='html') + print tmpl.generate(Context(**data)).render(method='html') times = [] for i in range(100): start = datetime.now() - list(tmpl.generate(ctxt)) + list(tmpl.generate(Context(**data))) sys.stdout.write('.') sys.stdout.flush() times.append(datetime.now() - start)