templating system

Ksenia Marasanova ksenia.marasanova at gmail.com
Sun Apr 10 11:55:06 EDT 2005


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!

-- 
Ksenia



More information about the Python-list mailing list