Discussion:
Perl Template Toolkit: Now in spicy new Python flavor
(too old to reply)
e***@gmail.com
2008-01-14 23:00:52 UTC
Permalink
I'd like to inform the Python community that the powerful and popular
Template Toolkit system, previously available only in its original
Perl implementation, is now also available in a beta Python
implementation:

http://tt2.org/python/index.html

I created this port both as a fun programming project, and for use in
environments where Perl is not available, for reasons technical,
cultural, or otherwise. The extensive Perl test suites have also been
ported, and most templates require no or very little modification.

Discussion of the Python implementation should be conducted on the
main Template Toolkit developer mailing list; see the site above for
details.
SJ Carter
2008-01-15 19:29:58 UTC
Permalink
Congrats. This will no doubt prove valuable to any Python programmer.
Joshua Kugler
2008-01-15 20:15:27 UTC
Permalink
Post by e***@gmail.com
I'd like to inform the Python community that the powerful and popular
Template Toolkit system, previously available only in its original
Perl implementation, is now also available in a beta Python
http://tt2.org/python/index.html
I created this port both as a fun programming project, and for use in
environments where Perl is not available, for reasons technical,
cultural, or otherwise. The extensive Perl test suites have also been
ported, and most templates require no or very little modification.
I must say...wow. That would have saved me some time and hassle about a
year ago, but of course, I wouldn't have fell in love with pure XML
templates either. :) As someone who has used Template Toolkit quite a bit,
I must say that is is quite cool. Congrats on a job well done!

j
George Sakkis
2008-01-15 21:45:59 UTC
Permalink
Post by Joshua Kugler
Post by e***@gmail.com
I'd like to inform the Python community that the powerful and popular
Template Toolkit system, previously available only in its original
Perl implementation, is now also available in a beta Python
http://tt2.org/python/index.html
I created this port both as a fun programming project, and for use in
environments where Perl is not available, for reasons technical,
cultural, or otherwise. The extensive Perl test suites have also been
ported, and most templates require no or very little modification.
I must say...wow. That would have saved me some time and hassle about a
year ago, but of course, I wouldn't have fell in love with pure XML
templates either. :) As someone who has used Template Toolkit quite a bit,
I must say that is is quite cool. Congrats on a job well done!
j
How does it compare with other "mainstream" Python template engines
such as Cheetah, Mako, etc. ? Unless I missed it, the documentation
covers the Perl version only.

George
e***@gmail.com
2008-01-16 20:01:43 UTC
Permalink
Post by George Sakkis
Post by e***@gmail.com
I'd like to inform the Python community that the powerful and popular
Template Toolkit system, previously available only in its original
Perl implementation, is now also available in a beta Python
http://tt2.org/python/index.html
I created this port both as a fun programming project, and for use in
environments where Perl is not available, for reasons technical,
cultural, or otherwise. The extensive Perl test suites have also been
ported, and most templates require no or very little modification.
How does it compare with other "mainstream" Python template engines
such as Cheetah, Mako, etc. ?
I can't claim a comprehensive familiarity with Python template
offerings, but all of the packages approved for use at my previous
workplace left me cold. The most popular were ClearSilver and Django,
and both felt horribly limiting compared to the Template Toolkit,
which I became acquainted with when hacking on Bugzilla some years
ago. Neither supports what I would consider very basic operations on
the template data. Nothing like the following can be expressed in
those packages:


from pprint import PrettyPrinter
from template import Template

print Template().processString(
"the list is [% a.pformat(b(c + d)) %]",
{ "a": PrettyPrinter(2, 40), "b": range, "c": 10, "d": 20 }
)


Here we have a template that includes a method call, a function call,
and simple addition. Neither Django nor ClearSilver can manage any of
these three things. Both of those packages offer other features not
found in the Template Toolkit; it was the relative impotence of the
templating systems that drove me to attack the translation.
Post by George Sakkis
Unless I missed it, the documentation
covers the Perl version only.
The online documentation, yes. All source-level documentation (from
which the online documentation is largely drawn) has been converted
into Python docstrings in the source code. They can be read by
browsing the Subversion repository or by importing the code and using
Post by George Sakkis
Post by e***@gmail.com
import template.stash
help(template.stash)
... module docs ...
Post by George Sakkis
Post by e***@gmail.com
help(template.stash.Stash)
... class docs ...
Post by George Sakkis
Post by e***@gmail.com
help(template.stash.Stash.get)
... method docs ...
Bruno Desthuilliers
2008-01-17 16:57:24 UTC
Permalink
Post by e***@gmail.com
Post by George Sakkis
Post by e***@gmail.com
I'd like to inform the Python community that the powerful and popular
Template Toolkit system, previously available only in its original
Perl implementation, is now also available in a beta Python
http://tt2.org/python/index.html
I created this port both as a fun programming project, and for use in
environments where Perl is not available, for reasons technical,
cultural, or otherwise. The extensive Perl test suites have also been
ported, and most templates require no or very little modification.
How does it compare with other "mainstream" Python template engines
such as Cheetah, Mako, etc. ?
I can't claim a comprehensive familiarity with Python template
offerings, but all of the packages approved for use at my previous
workplace left me cold. The most popular were ClearSilver and Django,
and both felt horribly limiting compared to the Template Toolkit,
ClearSilver is not a Python templating system, but a C templating system
with bindings for various languages including Python. Being (by design)
language-agnostic, it's indeed *very* limited (and that's an
understatement).

wrt/ Django templates, it indeed imposes severe limitations on what can
be simply expressed when you are familiar with Python. This is by design
- since it has been designed to be safe to use for non-programmers. Now
while not my cup of tea, it has proven to be fairly usable, quite less
limiting that what I feared at first, and really easy to use for our web
designer/integrator.

Now there are way more flexible/expressive templating systems in Python,
either XML oriented (genshi) or more generic (my favorite one so far
being Mako).

But anyway, I'm not the one that will complain with Perl templating
systems being ported to Python - FWIW, Mako was born from it's author
previous experience with porting Mason to Python !-)
Paul Boddie
2008-01-17 17:29:42 UTC
Permalink
Post by e***@gmail.com
I can't claim a comprehensive familiarity with Python template
offerings, but all of the packages approved for use at my previous
workplace left me cold.
There are a few offerings listed on this page:

http://wiki.python.org/moin/Templating

I suppose you could add Template Toolkit somewhere on that page,
indicating where it fits into the bigger picture.

Paul
e***@gmail.com
2008-01-18 18:03:52 UTC
Permalink
Post by e***@gmail.com
Post by George Sakkis
Unless I missed it, the documentation
covers the Perl version only.
The online documentation, yes. All source-level documentation (from
which the online documentation is largely drawn) has been converted
into Python docstrings in the source code.
Augh! And I forgot to mention that there's a file README.python at
the top level of the repository that discusses several of the issues
that arose in converting a large Perl project into Python, and how I
addressed them. Possibly interesting reading.

http://tt2.org/svnweb/Template-Python/view/trunk/README.python
j***@gmail.com
2014-10-08 01:51:42 UTC
Permalink
Sorry, is anyone else having trouble opening the README.txt?
Post by e***@gmail.com
I'd like to inform the Python community that the powerful and popular
Template Toolkit system, previously available only in its original
Perl implementation, is now also available in a beta Python
http://tt2.org/python/index.html
I created this port both as a fun programming project, and for use in
environments where Perl is not available, for reasons technical,
cultural, or otherwise. The extensive Perl test suites have also been
ported, and most templates require no or very little modification.
Discussion of the Python implementation should be conducted on the
main Template Toolkit developer mailing list; see the site above for
details.
Chris Angelico
2014-10-08 02:09:19 UTC
Permalink
Post by j***@gmail.com
Sorry, is anyone else having trouble opening the README.txt?
Post by e***@gmail.com
I'd like to inform the Python community that the powerful and popular
Template Toolkit system, previously available only in its original
Perl implementation, is now also available in a beta Python
http://tt2.org/python/index.html
I created this port both as a fun programming project, and for use in
environments where Perl is not available, for reasons technical,
cultural, or otherwise. The extensive Perl test suites have also been
ported, and most templates require no or very little modification.
Discussion of the Python implementation should be conducted on the
main Template Toolkit developer mailing list; see the site above for
details.
You're top-posting from Google Groups in response to a six-year-old
post. At least you provided us with some context. But you're looking
at something pretty ancient, so a more appropriate response would be
to first search the web to see if the URL's changed, and if you're
still having trouble, to ask (as a brand new thread) something like "I
found this from six years ago, does anyone know if it's still
active?". We here on comp.lang.python / python-list don't have the
power to help you; you need the original author, whose contact details
can probably be found by poking around on the web site you quoted the
link to.

ChrisA

Loading...