Re: Are you using the Unspecified class
Tavis Rudd <[email protected]> Sat, 27 Jun 2009 22:32:52 -0700 (PDT)
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <alpine.LNX.2.00.0906272154530.8886@o2> |
On Sat, 27 Jun 2009, R. Tyler Ballance wrote: > There is a Cheetah internal class called "Unspecified" that I'd like to > prune from the tree and replace with None, but I'd like to double check > that you folks aren't using it for anything outside of Cheetah (it seems > to be a relic in the Cheetah internals that need not exist). Tyler, There is a subtle, but important difference between using Unspecified and None for the optional args to Template.compile. 'Unspecified' is more than just an weird alternate name for None. Have a look at the valOrDefault func used in Template.compile(). If the argument is 'Unspecified' it falls back to the default values defined as _CHEETAH_xxx class attributes in the Template class, or possibly in a subclass of Template which provides custom defaults (a usage pattern I use frequently to avoid repeating stuff throughout my client code). For some arguments/attributes None is a legal value; cacheStore and compilerSettings for example. If you replace Unspecified with None, it will become impossible for subclasses to provide their own defaults as class attributes as the default compilerSettings=None (etc.) in Template.compile() would always trump them. The same logic applies to arguments/attributes that are boolean. Please leave Unspecified where it is. It serves a real purpose and nothing is gained by removing it. However, we should probably get rid of the redefined Unspecified I just noticed in Tests/SyntaxAndOutput.py. Cheers, Tavis > > > Do let me know if you use it > > CHeers > > -R. Tyler Ballance > Slide, Inc. > ------------------------------------------------------------------------------