The codeTemplate class contains not only the Cheetah infrastructure, but also
some convenience methods useful in all templates. More methods may be added if
it's generally agreed among Cheetah developers that the method is sufficiently
useful to all types of templates, or at least to all types of HTML-output
templates. If a method is too long to fit into Template
- especially
if it has helper methods - put it in a mixin class under Cheetah.Utils
and inherit it.
Routines for a specific problem domain should be put under
Cheetah.Tools
, so that it doesn't clutter the namespace unless the user
asks for it.
Remember: Cheetah.Utils
is for objects required by any part of Cheetah's
core. Cheetah.Tools
is for completely optional objects. It should
always be possible to delete Cheetah.Tools
without breaking Cheetah's
core services.
If a core method needs to look up an attribute defined under
Cheetah.Tools
, it should use hasattr()
and gracefully provide a
default if the attribute does not exist (meaning the user has not imported that
subsystem).