April 17th, 2005, 02:40 PM
Compiled Cheetah templates and CGI
I have built a simple CMS where I use Cheetah templates and CGI. For this I use a template manager that originally stored compiled templates in memory (works with persistent applications like CherryPy) but that does not work with CGI. My first idea was to pickle the compiled templates but that raises a TypeError. The error message is "can't pickle instancemethod objects".
Does anyone know a way around this? I tried storing the compiled templates in a BLOB field in the database but that doesn't seem to work either.
As it is, without compiled templates, building a page takes around 0.50 seconds and ~90% of the time is used for compiling the templates so I would really like to solve this problem.
Alternatively, can anyone recommend a template module that does not compile templates or creates picklable templates but is still quite fast?
I've tried PXTL but that turned out to be even slower.