Re: Overriding getFileContents()

Tavis Rudd <[email protected]> Mon, 8 Mar 2010 19:25:43 -0800 (PST)
Newsgroups gmane.comp.python.cheetah
Message-ID <alpine.LNX.2.00.1003081919390.4201@o3>
Hi Andreas,
The #import directive gets compiled into a Python import statement. 
Cheetah doesn't handle the import itself. Thus, you would need to write an 
import hook in order to have #import load templates from the db: see 
http://pycon.blip.tv/file/3259501/ and 
http://pypi.python.org/pypi/importlib/1.0.1

Alternatively, you could hack the way Cheetah compiles the #import and 
#extends directives, but that's probably more work than writing an import 
hook.

Tavis

On Mon, 8 Mar 2010, Andreas Kahler wrote:

> Hi!
>
> I have a use case where I want to store my Cheetah templates in a
> database instead of the file system.
> I thought that would be possible by overriding the getFileContents method.
> I got it working for #import raw directives, but it doesn't work for
> #import (without raw).
> Is this a bug or am I missing something?
> Also, can you use #extend together with getFileContents?
>
> Best regards,
> Andreas
>
> ------------------------------------------------------------------------------
> Download Intel&#174; Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev