Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > ANN: pyTenjin 0.8.0 - much faster template engine than Django

Thread Tools

ANN: pyTenjin 0.8.0 - much faster template engine than Django

Posts: n/a
I have released pyTenjin 0.8.0

pyTenjin is the fastest template engine for Python.

* Very fast (about 10 times faster than Django template engine)
* Easy to learn (no need to learn template-original language)
* Full-featured (layout template, partial template,
preprocessing, ...)
* Very small (only 1,200 lines, one file)
* Goole AppEngine supported.

Changes from 0.7.0

HTML helper function 'tagattr()' is renamed to 'tagattrs()'.
(Notice that new 'tagattr()' is added. See below.)

* 'tagattrs()' is changed to add ' ' (space) at the first character.
(0.7.0) tagattr(klass='error') #=> 'class="error"'
(0.7.1) tagattrs(klass='error') #=> ' class="error"'

* 'tagattrs()' is changed to handle 'checked', 'selected', and
'disabled' attributes.
>>> from tenjin.helpers.html import *
>>> tagattrs(checked=True, selected='Y', disabled=1)

' checked="checked" selected="selected" disabled="disabled"'
>>> tagattrs(checked=False, selected='', disabled=0)



Template caching is changed to keep template file's timestamp
instead of create time of cached object. See
for details. (Thanks Steve)


* Add new HTML helper function 'tagattr()'.
(Notice that 'tagattr()' in 0.7.0 is renamed into 'tagattrs()'.)
>>> from tenjin.helpers.html import *
>>> tagattr('size', 20)

' size="20"'
>>> tagattr('size', 0)

>>> tagattr('size', 20, 'large')

' size="large"'
>>> size = 20 # you can use tagattrs() instead of tagattr

>>> tagattrs(size=(size and 'large'))

' size="large"'

* Add new HTML helper function 'new_cycle()'.
>>> from tenjin.helpers.html import *
>>> cycle = new_cycle('odd, 'even')
>>> cycle()

>>> cycle()

>>> cycle()

>>> cycle()


* (experimental) Template converter is changed to add dummy if-
when first Python statement is indented. (Thanks Steve)
$ cat ex.pyhtml
<?py for item in items: ?>
<?py #end ?>
$ pytenjin -sb ex.pyhtml
<ul>\n''', ));
if True: ## dummy
for item in items:
_buf.extend((''' <li>''', escape(to_str(item)),
'''</li>\n''', ));
_buf.extend((''' </ul>
</html>\n''', ));

* Update User's Guide and FAQ.

Have fun!

makoto kuwata

Reply With Quote
Igor Katson
Posts: n/a
kwatch wrote:
> I have released pyTenjin 0.8.0

Thanks for your project. I have used it a little, and there is a
question to you.

import tenjin
from tenjin.helpers import *
shared_cache = tenjin.GaeMemcacheCacheStorage()
engine = tenjin.Engine(cache=shared_cache)

1. Why should I import tenjin.helpers if I don't use the helpers in my code?
2. Why does the code not work if I don't import the helpers?

I think you should manage this issue inside the library.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ANN: pyTenjin 1.0.0 - a high-speed and full-featured template engine Makoto Kuwata Python 1 02-22-2011 02:31 PM
ANN: pyTenjin 0.9.0 - very fast and full-featured template engine Makoto Kuwata Python 0 07-19-2010 02:48 PM
ANN: pyTenjin 0.8.1 - much faster template engine than Django kwatch Python 0 06-14-2009 08:06 AM
[ANN] pyTenjin 0.7.0 - the fastest and full-featured template engine kwatch Python 0 05-24-2009 03:57 PM
[ANN] pyTenjin 0.6.2 - a fast and full-featured template engine makoto kuwata Python 0 02-27-2008 03:20 PM