[Zope-CMF] Re: [dev] CMFSetup: proposal for improving handlers

yuppie y.2004_ at wcm-solutions.de
Mon Dec 13 03:50:30 EST 2004


Dieter Maurer wrote:
> yuppie wrote at 2004-12-11 11:46 +0100:
> 
>>Dieter Maurer wrote:
>>
>>>yuppie wrote at 2004-12-10 15:25 +0100:
>>>
>>>
>>>>...
>>>>_KEY: If specified, that key is used in the resulting dict instead of 
>>>>the subnode/attribute name. If None, the value of a single 
>>>>subnode/attribute is returned instead of the dict.
>>>
>>>
>>>Why do you want to use such strange spelling? "_KEY" rather than "key"?
>>>Is there any danger for name conflicts?
>>
>>Well. It doesn't look very strange to me: The leading underscore 
>>signalizes "internal use", uppercase a constant.
>>
>>But I'll change it to "KEY" because "internal use" is not really true.
> 
> 
> Are these keys more "constant" than usual dictionary keys?
> Are all your dictionary keys spelled in all capital letters?
> 

Seems the context got lost. This is a part of my example, now without 
underscores:

     { 'permission': {KEY: 'permissions', DEFAULT: ()} }

KEY and DEFAULT are not dictionary keys, they are constants that contain 
dictionary keys.

I started my prototype with explicit dictionary keys like here:

     { 'permission': {'key': 'permissions', 'default': ()} }

But I replaced them later with constants imported from one place to 
catch typos easily.


Cheers, Yuppie



More information about the Zope-CMF mailing list