About
pyTenjin is a very fast and full-featured template engine. You can embed Python statements and expressions into your template file. pyTenjin converts it into Python script and evaluate it.
!!ATTENTION!!
pyTenjin is enough stable, but it is under beta release. It means that API or specification may change in the future.
Features
Very fast
About x10 faster than Django, x4 than Cheetah, x2 than Mako
In addition loading tenjin.py is very lightweight (important for CGI)
Full featured
Nestable layout template
Partial template
Fragment cache
Capturing
Preprocessing
Easy to learn
You don’t have to learn template-specific language
Supports Google App Engine
See User’s Guide and Changes for details.
Install
$ sudo easy_install Tenjin
Or:
$ tar xzf Tenjin-X.X.X.tar.gz $ cd Tenjin-X.X.X $ sudo python setup.py install
Or just copy ‘lib/tenjin.py’ and ‘bin/pytenjin’ into proper directory.
(Optional) Install PyYAML.
Example
example.pyhtml:
<?py # -*- coding: utf-8 -*- ?>
<?py #@ARGS items ?>
<table>
<?py cycle = new_cycle('odd', 'even') ?>
<?py for item in items: ?>
<tr class="#{cycle()}">
<td>${item}</td>
</tr>
<?py #endfor ?>
</table>
example.py:
import tenjin
#tenjin.set_template_encoding('utf-8') # optional (defualt 'utf-8')
from tenjin.helpers import *
from tenjin.html import *
#import tenjin.gae; tenjin.gae.init() # for Google App Engine
engine = tenjin.Engine()
context = { 'items': ['<AAA>', 'B&B', '"CCC"'] }
html = engine.render('example.pyhtml', context)
print(html)
Output:
$ python example.py
<table>
<tr class="odd">
<td><AAA></td>
</tr>
<tr class="even">
<td>B&B</td>
</tr>
<tr class="odd">
<td>"CCC"</td>
</tr>
</table>
See other examples .
Metadata
Release files for Tenjin 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Tenjin-1.1.1.tar.gz | 206.8 kB | Without provenance | Details for Tenjin-1.1.1.tar.gz |
Release files / Tenjin-1.1.1.tar.gz
| Download URL | Tenjin-1.1.1.tar.gz |
|---|---|
| Size | 206.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5e044f3e2c0fc5f5f1162273d541b8f592036c7f9ef99444ff540704e404697
|
|
BLAKE2b-256 checksum How to use checksums |
318f53d4140a5100ce21fef6294ce06be82aa5b7942be27355e532343901eb57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Tenjin 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.