Loading ...
Sorry, an error occurred while loading the content.
 

[Cheetahtemplate-discuss] Overriding getFileContents()

Expand Messages
  • Andreas Kahler
    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
    Message 1 of 2 , Mar 8, 2010
      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® 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
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    • Tavis Rudd
      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
      Message 2 of 2 , Mar 8, 2010
        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® 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
        > Cheetahtemplate-discuss@...
        > https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
        >

        ------------------------------------------------------------------------------
        Download Intel® 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
        Cheetahtemplate-discuss@...
        https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
      Your message has been successfully submitted and would be delivered to recipients shortly.