Are you using the Unspecified class

View: New views
3 Messages — Rating Filter:   Alert me  

Are you using the Unspecified class

by R. Tyler Ballance-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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).


Do let me know if you use it

CHeers

-R. Tyler Ballance
Slide, Inc.


------------------------------------------------------------------------------

_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

attachment0 (204 bytes) Download Attachment

Re: Are you using the Unspecified class

by Tavis Rudd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



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.
>

------------------------------------------------------------------------------
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

Re: Are you using the Unspecified class

by R. Tyler Ballance-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Tavis, reply inline..

On Sat, 27 Jun 2009, Tavis Rudd wrote:

>
>
> 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.
Interesting, I suppose I'm far more unfamiliar with how you and likely
others are using those settings that are being passed through.

I'll revert my commits and prune that dupe in the test.

-R. Tyler Ballance
Slide, Inc.


------------------------------------------------------------------------------

_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@...
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

attachment0 (204 bytes) Download Attachment