[Zope-dev] DataSkin propoerty Sheets/Providers.

Phillip J. Eby pje@telecommunity.com
Thu, 03 Aug 2000 09:28:50 -0500


At 07:09 PM 8/2/00 -0600, Bill Anderson wrote:
>I think I have a decent handle on this concept, but something seems
lacking, I hope
>someone can clear it up :)
>
>So, let us say I have an object, call it a Member. :)
>And let us say I want to be able to add a property sheet to it in a
customizer/specialist.
>AIUI, I should be able to add a persistent sheet provider, give it the
name I want for the
>sheet, and define the sheet?
>
>Geex, the more I write what I want to do, the less I feel I grasp it. :(
>
>Basically, let me put it this way:
>I have DataSkins (ZClasses). I have one or two property sheets that I want
most/all of the
>DS objects to have. I don't want to have to define the property sheet in
each and every
>ZClass. AIUI, PersistentSheet providers can do this. I want to do it with
the default
>ZPatterns/LoginManager includes.
>
>So, am I totally clueless, or am I just looking to hard, and missing
something blatantly
>obvious?
>

PersistentSheetProviders can do what you want - *but* there is one
drawback.  PSP's have no concept of a sheet schema, so you have to add the
sheet and set up its schema in code for *each instance*.  The good news is,
you can do that from an "add" trigger, by calling
self.propertysheets.manage_addPropertySheet(id='name', xmlns=''), followed
by self.propertysheets.get('name').manage_editProperties(...).  (You can
even do it as a tuple expression, i.e. just seperate the two expressions
with a comma.  Rendered in SkinScript it would look like:

WHEN OBJECT ADDED CALL
self.propertysheets.manage_addPropertySheet(id='name',xmlns=''),
self.propertysheets.get('name').manage_editProperties(...)

(The "..." should be replaced with appropriate parameters for
manage_editProperties, of course.)  Unfortunately, this will not allow you
to initialize the property sheet contents except with constant data, data
from the instance, or from self.REQUEST.