[ANN] pyTenjin 0.6.2 - a fast and full-featured template engine

makoto kuwata kwa at kuwata-lab.com
Wed Feb 27 16:20:52 CET 2008


I have released pyTenjin 0.6.2.
http://www.kuwata-lab.com/tenjin/
This is a tiny bug fix release.

pyTenjin is the fastest template engine for Python.
Not only very fast, but also full-featured and easy-to-use is
pyTenjin.
You can embed Python statements and expressions into your text file.
Tenjin converts it into Python program and evaluate it.

Features:
* very fast
  - x2 faster than Mako
  - x3 faster than Cheetah and Myghty
  - x9 faster than Django
  - x60 faster than Kid
* Full-featured
  - layout template
  - partial template
  - capturing
  - preprocessing
  - and so on...

You can see the detail of benchmark at:
http://www.kuwata-lab.com/tenjin/
(benchmark script is included in pyTenjin distribution.)


Installation:

   $ easy_install Tenjin
   ## or download, extract, and execute 'setup.py'


Example: template.pyhtml

   <h1>${title}</h1>
   <ul>
   <?py for item in items: ?>
     <li>${item}
         #{item}</li>
   <?py #end ?>
   </ul>

Example: main.py

   import tenjin
   from tenjin.helpers import to_str, escape
   engine = tenjin.Engine()
   context = { 'title': 'pyTenjin Example',
               'items': ['<AAA>', 'B&B', '"CCC"'] }
   output = engine.render('template.pyhtml', context)
   print output,

Example: result

   $ python main.py
   <h1>pyTenjin Example</h1>
   <ul>
     <li>&lt;AAA&gt;
         <AAA></li>
     <li>B&amp;B
         B&B</li>
     <li>&quot;CCC&quot;
         "CCC"</li>
   </ul>


See user's guide and examples at the above page for details.
New release of pyTenjin will be informed at:
http://www.kuwata-lab.com/support/


Release 0.6.2:

[Changes]

  * When '-S', '-a retrieve', '-X', or '-a statements' specified,
    pytenjin command replaces text before expressions into spaces
    and print it.

[Bugfix]

  * pytenjin command printed "\n\n" instead of "\n" when '-U'
specified.
    Fixed to print "\n".


--
regards,
makoto kuwata




More information about the Python-list mailing list