Cheetah best for templating?

Discussion in 'Python' started by Roger Jack, Jan 3, 2004.

  1. Roger Jack

    Roger Jack Guest

    I have just finished reading Code Generation In Action which uses Ruby for
    code generation. I would like to use Python instead. Is Cheetah the best
    tool to use for templating source code files and then generating code? Is
    there something more mature or better?

    Thanks!

    --
    Roger Jack
    Elegance Technologies, Inc.
    484.431.1775

    www.elegancetech.com
     
    Roger Jack, Jan 3, 2004
    #1
    1. Advertisements

  2. Roger Jack

    Rene Pijlman Guest

    Roger Jack:
    I've choosen it for a project recently and IMO it's a good templating
    system.

    It would be good to get a little more guidance for using it in an easy
    PHP-way with mod_python, but other than that I have no gripes.
     
    Rene Pijlman, Jan 3, 2004
    #2
    1. Advertisements

  3. I tend to think highly of EmPy, but that's not exactly a surprise :):

    http://www.alcyone.com/software/empy/

    I do know that there are several people on the EmPy mailing list using
    EmPy for exactly the purpose you're considering.

    What's going to be best for you is really going to depend on your
    aesthetic sensibilities; pretty much all of templating systems' base
    features are universal, just expressed in different ways. The only
    thing that might objectively make one system better than another for you
    would be ancillary features which are included on top.
     
    Erik Max Francis, Jan 3, 2004
    #3
  4. Roger Jack

    Giles Brown Guest

    I had a project where I wanted to generate some pro*c + C++ database code.
    I found that the Python Template Language that comes with Quixote was
    very convenient for this purpose, because it avoids needing to learn
    another syntax.

    Quixote: http://www.mems-exchange.org/software/quixote/
    PTL: http://www.mems-exchange.org/software/quixote/doc/PTL.html

    Regards,
    Giles
     
    Giles Brown, Jan 4, 2004
    #4
  5. Roger Jack

    Wilk Guest

    My graphist and me found it excellent, fast, clear, simple, stable : Pythonic !

    We found the others engines too verbose, more perlish ;-)

    Like python, the best is to try somes engines, you will see quickly wich
    one you need. First, like everybody, i did my own engine, but Cheetah
    was finaly a better wheel !

    I use it to generate html, latex and xml
     
    Wilk, Jan 4, 2004
    #5
  6. Roger Jack

    Ville Vainio Guest

    Including yours truly. Also, the source code generation problem might
    be solved trivially by checking out

    http://www.students.tut.fi/~vainio24/pywiz/
    Also, there is very little to lose by taking a cursory glance at each
    one and choosing what seems easiest (assuming they have the same level
    of power).

    Short EmPy tutorial:

    ---------- myfile.em -------------------

    @{
    # statements
    import time
    var1 = 12
    var2 = "Hello"
    }

    @var2 World! @var1 plus one is @(var1+1)
     
    Ville Vainio, Jan 5, 2004
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.