[ZPatterns] DataSkin: attributes defined in a class

Phillip J. Eby pje@telecommunity.com
Fri, 13 Jul 2001 13:11:02 -0500


At 07:23 PM 7/13/01 +0200, Ulrich Eck wrote:
>Thanks for all your answers this week ..
>
>I just want to verify that i got this one right:
>
>When I subclass from DataSkin I cannot make use of predefined attributes
>e.g. manage_options if there are no AttributeProviders defined (e.g. when
>subclassing from that class a ZClass).
>
>after reading sources for a while i found "class_default_for_%s" in
>DataSkin.__getattr__ ..
>
>Is it correct, that if I name an Attribute e.g.
>
>class_default_for_manage_options
>
>that allways the value from the class-definition is returned when I
>access <instance>.manage_options ??

Not always.  Only if another provider (such as a SkinScript declaration or 
a ClassExtender) doesn't provide a value for the 
attribute.  "class_default_for_%s" is a last resort, and it's there to work 
around the fact that in normal Python you can't override attributes which 
already exist in your dictionary or class.