templating system

Ron_Adam radam2_ at _tampabay.rr.com
Mon Apr 11 00:09:49 EDT 2005


On Sun, 10 Apr 2005 17:55:06 +0200, Ksenia Marasanova
<ksenia.marasanova at gmail.com> wrote:

>Hi,
>
>I am looking for fast, simple templating system that will allow me to
>do the following:
>- embed Python code (or some templating code) in the template
>- generate text output (not only XML/HTML)
>
>I don't need a framework (already have it), but just simple
>templating. The syntax I had in mind is something like that:
>
># in Python module
>def some_view():
>    # some code goes here...
>    records = get_some_data()
>    req = get_request_class()
>    return template('some_template.tmpl', **locals()).render()
>
># in some_template.tmpl:
>
><ul>
><%for record in records%>
>    <li><a href="<%=record.id%>"><%=record.title%></a></li>
><%end for%>
></ul>
>
>
>>From what I saw Cheetah seems to be the only one that can do it. I was
>hoping there might be alternatives that I've missed :)
>Thanks!

I use Cheetah along with publish.py by Chris Gonnerman.  Cheetah
constructs web pages using .html templates and a python script, (which
is why I like it).  Publish.py gives me fast one click publishing to
the web server, adding or removing files from the server to match my
local publish directory.  

Looks like Chris also has a templating program here as well.  I
haven't checked it out yet, so can't tell you about it.

http://newcenturycomputers.net/projects/webpub.html

Cheers,
Ron




More information about the Python-list mailing list