17.6 Tools

Package Cheetah.Tools contains functions and classes contributed by third parties. Some are Cheetah-specific but others are generic and can be used standalone. None of them are imported by any other Cheetah component; you can delete the Tools/ directory and Cheetah will function fine.

Some of the items in Tools/ are experimental and have been placed there just to see how useful they will be, and whether they attract enough users to make refining them worthwhile (the tools, not the users :).

Nothing in Tools/ is guaranteed to be: (A) tested, (B) reliable, (C) immune from being deleted in a future Cheetah version, or (D) immune from backwards-incompatable changes. If you depend on something in Tools/ on a production system, consider making a copy of it outside the Cheetah/ directory so that this version won't be lost when you upgrade Cheetah. Also, learn enough about Python and about the Tool so that you can maintain it and bugfix it if necessary.

If anything in Tools/ is found to be necessary to Cheetah's operation (i.e., if another Cheetah component starts importing it), it will be moved to the Cheetah.Utils package.

Current Tools include:

Cheetah.Tools.MondoReport an ambitious class useful when iterating over records of data (#for loops), displaying one pageful of records at a time (with previous/next links), and printing summary statistics about the records or the current page. See MondoReportDoc.txt in the same directory as the module. Some features are not implemented yet. MondoReportTest.py is a test suite (and it shows there are currently some errors in MondoReport, hmm). Contributed by Mike Orr.

Cheetah.Tools.RecursiveNull Nothing, but in a friendly way. Good for filling in for objects you want to hide. If $form.f1 is a RecursiveNull object, then $form.f1.anything["you"].might("use") will resolve to the empty string. You can also put a RecursiveNull instance at the end of the searchList to convert missing values to '' rather than raising a NotFound error or having a (less efficient) errorCatcher handle it. Of course, maybe you prefer to get a NotFound error... Contributed by Ian Bicking.

Cheetah.Tools.SiteHierarchy Provides navigational links to this page's parents and children. The constructor takes a recursive list of (url,description) pairs representing a tree of hyperlinks to every page in the site (or section, or application...), and also a string containing the current URL. Two methods 'menuList' and 'crumbs' return output-ready HTML showing an indented menu (hierarchy tree) or crumbs list (Yahoo-style bar: home > grandparent > parent > currentURL). Contributed by Ian Bicking.