[Zope-dev] zpatterns: how to specify default values?

Jephte CLAIN Jephte.Clain@univ-reunion.fr
Thu, 13 Jul 2000 22:37:32 +0400


"Phillip J. Eby" a écrit :
> Yes.  Name the attributes "class_default_for_X" where X is the attribute
> name.
Thanks very much.

> This works with the currently release ZPatterns, but alpha5 will go
> one better and let you create ZClass property sheets that transparently
> implement this.  That is, if you add a "DataSkin Property Sheet" to your
> ZClass instead of the standard "Common Instance Property Sheet", that
> sheet's attributes will be translated to/from the "class_default_for_X"
> names on the ZClass.
I don't use ZClass as I wrote only in Python. I really have to
understand how do propery sheets work.

What I don't understand is where the properties are stored. This is not
clear when I read the PropertyManager source. I guess property sheets
are for grouping some related attributes, but the actual work of
storing/retrieving the attribute is done by the attribute providers,
right?

If so, so be it :-)

By the way,

- is the python programmer have to mix PropertyManager in with DataSkin
to use property sheets? I guess so, but what, I seem to be the only one
who use zpatterns directly from python. All the ZClass junkies out there
do have all the mixin classes ready even before they start :-)

- I sometimes have a dataskin that is willing to get something from its
context. What is the preferred way to do this: try to acquire the
attribute from self._v_rack, wich is guaranteed to be wrapped in the
specialist's context, or just mix Acquisition.Implicit in with DataSkin?

regards,
jephte.clain@univ-reunion.fr