Cheetah 2.0 RC2 review

by on

Cheetah is a Python-powered template engine and code generator

License: MIT/X Consortium License
File size: 0K
Developer: Tavis Rudd
0 stars award from

Cheetah is a Python-powered template engine and code generator. Cheetah project can be used combined with other tools and frameworks or as a standalone application.

Web development is its principle use, but Cheetah is very flexible and is also being used to generate C++ game code, Java, sql, form emails and even Python code.

Cheetah has a large and active user community. Products built with Cheetah are used by most of the Fortune 500.

Here are some key features of "Cheetah":
is supported by every major Python web framework.
is fully documented and is supported by an active user community.
can output/generate any text-based format.
compiles templates into optimized, yet readable, Python code.
blends the power and flexibility of Python with a simple template language that non-programmers can understand.
gives template authors full access to any Python data structure, module, function, object, or method in their templates. Meanwhile, it provides a way for administrators to selectively restrict access to Python when needed.
makes code reuse easy by providing an object-oriented interface to templates that is accessible from Python code or other Cheetah templates. One template can subclass another and selectively reimplement sections of it. Cheetah templates can be subclasses of any Python class and vice-versa.
provides a simple, yet powerful, caching mechanism that can dramatically improve the performance of a dynamic website.
encourages clean separation of content, graphic design, and program code. This leads to highly modular, flexible, and reusable site architectures, shorter development time, and HTML and program code that is easier to understand and maintain. It is particularly well suited for team efforts.
can be used to generate static html via its command-line tool.

What is the philosophy behind Cheetah?

Its design was guided by these principles:

Python for the back end, Cheetah for the front end. Cheetah was designed to complement Python, not replace it.
Cheetah's core syntax should be easy for non-programmers to learn.
Cheetah should make code reuse easy by providing an object-oriented interface to templates that is accessible from Python code or other Cheetah templates.
Python objects, functions, and other data structures should be fully accessible in Cheetah.
Cheetah should provide flow control and error handling. Logic that belongs in the front end shouldn't be relegated to the back end simply because it's complex.
It should be easy to separate content, graphic design, and program code, but also easy to integrate them.
A clean separation makes it easier for a team of content writers, HTML/graphic designers, and programmers to work together without stepping on each other's toes and polluting each other's work. The HTML framework and the content it contains are two separate things, and analytical calculations (program code) is a third thing. Each team member should be able to concentrate on their specialty and to implement their changes without having to go through one of the others (i.e., the dreaded "webmaster bottleneck").
While it should be easy to develop content, graphics and program code separately, it should be easy to integrate them together into a website. In particular, it should be easy:
for programmers to create reusable components and functions that are accessible and understandable to designers.
for designers to mark out placeholders for content and dynamic components in their templates.
for designers to soft-code aspects of their design that are either repeated in several places or are subject to change.
for designers to reuse and extend existing templates and thus minimize duplication of effort and code.
and, of course, for content writers to use the templates that designers have created.

What's New in This Release:

Core Changes: [TR]

added lots more docstring content in the Template class
made multiline comments gobble whitespace like other directives, per JJ's request. The rather longwinded compiler setting gobbleWhitespaceAroundMultiLineComments can be used to go back to the old non-gobbling behaviour if needed.
added #capture directive to complement the #call directive. #call executes a region of Cheetah code and passes its output into a function call #capture executes a region of Cheetah code and assigns its output to a variable
extended the compile caching code in Template.compile so it works with the 'file' arg.
added cacheModuleFilesForTracebacks and cacheDirForModuleFiles args to Template.compile(). See the docstring for details.
misc internal refactoring in the parser
improved handling of keyword args in the __init__ method and fixed a potential clash between the namespaces and searchList args


added the source for the new Cheetah website layout/content

Cheetah 2.0 RC2 search tags