<b>How do we setup Cheetah so it runs with all templates in the templates directory and all code in the .. directory<br><br>code.py</b><br>production=True<br><span style="color: rgb(204, 0, 0);">if not production:</span><br style="color: rgb(204, 0, 0);">
<span style="color: rgb(204, 0, 0);"> try:web.render('mafbase.tmpl', None, True, 'mafbase')</span><br style="color: rgb(204, 0, 0);"><span style="color: rgb(204, 0, 0);"> except:pass</span><br>else:<br>
from templates import mafbase<br><br><br>templates/mafbase.tmpl<br>templates/mafbase.py<br><br><br><span style="color: rgb(204, 0, 0);"> try:web.render('mafbase.tmpl', None, True, 'mafbase')<br>This works but is very slow to load and causes timeout errors<br>
<br><br></span> from templates import mafbase<br><br>This doesnt work<br> return self._delegate(fn, self.fvars, args)<br> File "/home/mark/work/common/web/application.py", line 411, in _delegate<br> return handle_class(cls)<br>
File "/home/mark/work/common/web/application.py", line 386, in handle_class<br> return tocall(*args)<br> File "user.py", line 262, in proxyfunc<br> return func(self, *args, **kw)<br> File "/home/mark/work/pop/code.py", line 1796, in GET<br>
return web.render('subclass.html')<br> File "/home/mark/work/common/web/cheetah.py", line 104, in render<br> return str(compiled_tmpl)<br> File "/usr/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux-i686.egg/Cheetah/Template.py", line 982, in __str__<br>
def __str__(self): return getattr(self, mainMethName)()<br> File "mafbase.py", line 634, in respond<br> File "/usr/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux-i686.egg/Cheetah/Template.py", line 1512, in _handleCheetahInclude<br>
nestedTemplateClass = compiler.compile(source=source,file=file)<br> File "/usr/lib/python2.5/site-packages/Cheetah-2.0.1-py2.5-linux-i686.egg/Cheetah/Template.py", line 693, in compile<br> fileHash = str(hash(file))+str(os.path.getmtime(file))<br>
File "/usr/lib/python2.5/posixpath.py", line 143, in getmtime<br> return os.stat(filename).st_mtime<br>OSError: [Errno 2] No such file or directory: '/home/mark/work/pop/widgetbox.html'<br><br><br clear="all">
<br>-- <br>Bidegg worlds best auction site<br><a href="http://bidegg.com">http://bidegg.com</a><br>