Skip to content

Instantly share code, notes, and snippets.

@rtyler
Created April 17, 2009 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtyler/96792 to your computer and use it in GitHub Desktop.
Save rtyler/96792 to your computer and use it in GitHub Desktop.
tyler@papaya:~> less foo.tmpl
from BaseClass import BaseClass
class $module.module(BaseClass):
pass
tyler@papaya:~> python
Python 2.6 (r26:66714, Dec 3 2008, 10:55:18)
[GCC 4.3.2 [gcc-4_3-branch revision 141291]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from Cheetah.Template import Template
>>> class FakeModule(object):
... module = 'Fakey'
...
>>> t = Template (file="foo.tmpl",searchList=[{'module' : FakeModule()}])
>>> f = open('genfoo.py', 'w')
>>> f.write(str(t))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib64/python2.6/site-packages/Cheetah/Template.py", line 988, in __str__
return getattr(self, mainMethName)()
File "_home_tyler_foo_tmpl.py", line 88, in respond
NameError: global name 'BaseClass' is not defined
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment