|



| |

Sprite is a simple, fast, and lightweight template engine implemented in Python.
Like any template enigne, it take a text(html) template file as input,
process the file and replace the variable tags with dynamic data, and display the resulted text.
3 features set Sprite apart from other engines:
 | Complete separation of presentation(html) and logic(Python code)
You can edit the HTML templates using your favorite HTML editor (such as
FrontPage, DreamWeaver, etc.) For those of you who want to embed python
code in a template, please read Terence Parr's excellent article
Enforcing Strict Model-View Separation in Template Engines. |
 | Templates are compiled to python program. This feature make Sprite one of
the FASTEST python template engine.
When Sprite encounters a template name, it checks in cache if the
corresponding python program exists in a cache location you specified.
If it doesn't, it read and parses the template file into a list and store the
list into a python program in cache and return the parsed text. Next
time it encounter the same template, it will not read the template at all,
instead it imports the python .py program. This results in a significant
speedup. After that, it will import python .pyc file(the .py file was
compiled into .pyc file when it is imported by Sprite in the second time!),
thus speed up your program even more. Sprite will automatically
regenerate the python programs if it detect you have changed your html
templates. |
 | Simple yet powerful
You specify a template, feed it with data and you display the result.
The data you feed to the template takes care of looping and other controls.
The whole program is less than 200 lines. You can easily modify it
to suit your own need. |
Now, check out these examples or download Sprite
|