comparison examples/doctest.txt @ 67:a0f7bfa98755

API templates now hobble along on their own two feet
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 Jan 2011 10:58:28 -0800
parents 0152741621c1
children 3571417ef92e
comparison
equal deleted inserted replaced
66:7821c82772f5 67:a0f7bfa98755
83 >>> from makeitso.template import MakeItSoTemplate, Variable 83 >>> from makeitso.template import MakeItSoTemplate, Variable
84 >>> class MyTemplate(MakeItSoTemplate): 84 >>> class MyTemplate(MakeItSoTemplate):
85 ... name = 'foo' 85 ... name = 'foo'
86 ... templates = ['example.txt'] 86 ... templates = ['example.txt']
87 ... vars = [Variable(name='name', default='bar')] 87 ... vars = [Variable(name='name', default='bar')]
88 >>> apitemplate = MyTemplate() 88 >>> buffer = tempfile.mktemp()
89 >>> apitemplate = MyTemplate(output=buffer)
90 >>> apitemplate.substitute()
91 >>> file(buffer).read().strip()
92 'Hello bar'
93 >>> os.remove(buffer)