Re: [Cheetahtemplate-discuss] Fwd: Cheetah, hard to debug ?!
Brought to you by:
rtyler,
tavis_rudd
From: Tavis R. <ta...@re...> - 2005-12-30 21:18:27
|
I've just cut 2.0b2. It includes this stuff. On Friday 30 December 2005 12:39 pm, Tavis Rudd wrote: > As JJ pointed out, this doesn't affect template modules that have been > compiled on the command line and then imported as regular Python modules. > Statically compile your templates and you'll get full tracebacks. > > However, it's not always possible or desirable to do statically compile.= =20 > To see the full line info in tracebacks from dynamically compiled templat= es > it's necessary to keep a copy of the generated Python source in a file th= at > Python can access. This wasn't possible with the old 'templateInstance = =3D > Template(src)' usage style, but it is with new 'templateClass =3D > Template.compile(src)' style in Cheetah 2.0. > > I've just checked in the code to support it. It's turned off by default.= =20 > To enable it you must create a subclass of Template that has the following > class attributes: > > class NiceTracebackTemplate(Template): > _keepGeneratedPythonModulesForTracebacks =3D True > _cacheDirForGeneratedPythonModules =3D 'xxxx' # change to a dirname > > templateClass =3D NiceTracebackTemplate.compile(src) > > Cheers, > Tavis > > On Friday 30 December 2005 4:50 am, Johan Fredrik =D8hman wrote: > > Hi, > > I have a project where I use Cheetath. I load the templates runtime > > through the Template(file=3D"") class. However, I find Cheetath quite > > hard to debug!! > > > > Look at this traceback: > > > > Traceback (most recent call last): > > File "/usr/local/lib/python2.4/site-packages/cherrypy/_cphttptools.py", > > line 271, in run > > main() > > File "/usr/local/lib/python2.4/site-packages/cherrypy/_cphttptools.py", > > line 502, in main > > body =3D page_handler(*args, **cherrypy.request.paramMap) > > File "/home/metro/common.py", line 94, in helper > > result =3D func(*p,**kwp) > > File "/home/metro/corp/partner.py", line 47, in viewclient > > return str(self.mainTemplate) > > File "<string>", line 50, in respond > > File "/usr/local/lib/python2.4/site-packages/Cheetah/Filters.py", > > line 113, in filter > > filtered =3D str(val) > > File "<string>", line 30, in respond > > TypeError: unsubscriptable object > > > > As you can see, it is not very obvious (to me at least) from this > > traceback where the error is. Are there any ways to get a more > > descriptive traceback which describes better in what template file and > > line which raises this error. > > > > thanks > > > > Johan Fredrik =D8hman > > > > > > -- > > Johan Fredrik =D8hman > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > > files for problems? Stop! Download the new AJAX search engine that > > makes searching your log files as easy as surfing the web. DOWNLOAD > > SPLUNK! http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3DClick > > _______________________________________________ > > Cheetahtemplate-discuss mailing list > > Che...@li... > > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log > files for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://ads.osdn.com/?ad_idv37&alloc_id=16865&op=3DClick > _______________________________________________ > Cheetahtemplate-discuss mailing list > Che...@li... > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss |