Cheetah Users' Guide
Next:
Contents
Cheetah Users' Guide
Edited by Mike Orr and Tavis Rudd
[email protected]
Contents
1 Introduction
1.1 Who should read this Guide?
1.2 What is Cheetah?
1.3 What is the philosophy behind Cheetah?
1.3.1 Why Cheetah doesn't use HTML-style tags
1.4 Give me an example!
1.5 Give me an example of a Webware servlet!
1.6 How mature is Cheetah?
1.7 Where can I get news?
1.8 How can I contribute?
1.8.1 Bug reports and patches
1.8.2 Example sites and tutorials
1.8.3 Template libraries and function libraries
1.8.4 Test cases
1.8.5 Publicity
1.9 Acknowledgements
1.10 License
2 Vocabulary
3 Getting Started
3.1 Requirements
3.2 Installation
3.3 Files
3.4 Uninstalling
3.5 The 'cheetah' command
3.6 Testing your installation
3.7 Quickstart tutorial
4 How Cheetah Works
4.1 Constructing Template Objects
4.2 ``cheetah compile'' and .py template modules
4.3 ``cheetah fill''
4.4 Some trivia about .py template modules
4.5 Running a .py template module as a standalone program
4.6 Object-Oriented Documents
5 Language Overview
5.1 Language Constructs - Summary
5.2 Placeholder Syntax Rules
5.3 Where can you use placeholders?
5.4 Are all those dollar signs really necessary?
5.5 NameMapper Syntax
5.5.1 Example
5.5.2 Dictionary Access
5.5.3 Autocalling
5.6 Namespace cascading and the searchList
5.7 Missing Values
5.8 Directive Syntax Rules
5.8.1 Directive closures and whitespace handling
6 Comments
6.1 Docstring Comments
6.2 Header Comments
7 Generating, Caching and Filtering Output
7.1 Output from complex expressions: #echo
7.2 Executing expressions without output: #silent
7.3 One-line #if
7.4 Caching Output
7.4.1 Caching individual placeholders
7.4.2 Caching entire regions
7.5 #raw
7.6 #include
7.7 #slurp
7.8 #indent
7.9 Ouput Filtering and #filter
8 Import, Inheritance, Declaration and Assignment
8.1 #import and #from directives
8.2 #extends
8.3 #implements
8.4 #set
8.5 #del
8.6 #attr
8.7 #def
8.8 #block ... #end block
9 Flow Control
9.1 #for ... #end for
9.2 #repeat ... #end repeat
9.3 #while ... #end while
9.4 #if ... #else if ... #else ... #end if
9.5 #unless ... #end unless
9.6 #break and #continue
9.7 #pass
9.8 #stop
9.9 #return
10 Error Handling
10.1 #try ... #except ... #end try, #finally, and #assert
10.2 #errorCatcher and ErrorCatcher objects
11 Instructions to the Parser/Compiler
11.1 #breakpoint
11.2 #compiler-settings
12 Fine Control over Cheetah-generated Python modules
12.1 Setting the source code encoding: #encoding
12.2 Setting the sh-bang: #shBang
13 Tips, Tricks and Troubleshooting
13.1 Placeholder Tips
13.2 Diagnostic Output
13.3 When to use Python methods
13.4 Calling superclass methods, and why you have to
13.5 All methods
13.6 Optimizing templates
13.7 PSP-style tags
13.8 Makefiles
13.9 Using Cheetah in a Multi-Threaded Application
13.10 Using Cheetah with gettext
14 Using Cheetah with Webware
14.1 Installing Cheetah on a Webware system
14.2 Containment vs Inheritance
14.2.1 The Containment Approach
14.2.2 The Inheritance Approach
14.3 Site frameworks
14.4 Directory structure
14.5 Initializing your template-servlet with Python code
14.6 Form processing
14.7 Form input, cookies, session variables and web server variables
14.7.1 .webInput()
14.8 More examples
Example A - a standalone servlet
Example B - a servlet under a site framework
Example C - several servlets with a common template
14.9 Other Tips
15 non-Webware HTML output
15.1 Static HTML Pages
15.2 CGI scripts
16 Non-HTML Output
16.1 Python source code
17 Batteries included: templates and other libraries
17.1 ErrorCatchers
17.2 FileUtils
17.3 Filters
17.4 SettingsManager
17.5 Templates
17.6 Tools
17.7 Utils
17.7.1 Cheetah.Templates.SkeletonPage
18 Visual Editors
A. Useful Web Links
A..1 Cheetah Links
A..2 Third-party Cheetah Stuff
A..3 Webware Links
A..4 Python Links
A..5 Other Useful Links
A..5.1 Python Database Modules and Open Source Databases
A..5.2 Other Template Systems
A..5.3 Other Internet development frameworks
B. Examples
B..1 Syntax examples
B..2 Webware Examples
C. Cheetah vs. Other Template Engines
C..1 Which features are unique to Cheetah
C..2 Cheetah vs. Velocity
C..3 Cheetah vs. WebMacro
C..4 Cheetah vs. Zope's DTML
C..5 Cheetah vs. Zope Page Templates
C..6 Cheetah vs. PHP's Smarty templates
C..7 Cheetah vs. PHPLib's Template class
C..8 Cheetah vs. PSP, PHP, ASP, JSP, Embperl, etc.
D. Optik license
About this document ...
Cheetah Users' Guide
Next:
Contents
Release 0.9.17rc1.