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

Phillip J. Eby pje@telecommunity.com
Thu, 13 Jul 2000 15:20:21 -0500


At 10:37 PM 7/13/00 +0400, Jephte CLAIN wrote:
>
>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?

PropertyManager stores properties as attributes.  ZClass property sheets
generally do the same.  So the work gets done by attribute providers if
you're using DataSkins.


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

If you're doing it from Python and you just want one property sheet, then
the answer is yes.  If you want multiple propertysheets, you need
propertysheet objects and/or a sheet provider.


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

DataSkins *are* Acquisition.Implicit already; there should be nothing you
need to do.  (Yes, I know they don't inherit from it, but that is because
they have an alternative implmentation of the __of__ method which is
functionally equivalent to that in Implicit, with some extra handling
needed by DataSkins.)