DataSkin propoerty Sheets/Providers.
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? -- Do not meddle in the affairs of sysadmins, for they are easy to annoy, and have the root password.
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.
"Phillip J. Eby" wrote:
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*.
Rats. :/
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.
OK, after the Wierd Al concert tonight, I'll give it a shot. :) -- Do not meddle in the affairs of sysadmins, for they are easy to annoy, and have the root password.
At 05:38 PM 8/3/00 -0600, Bill Anderson wrote:
"Phillip J. Eby" wrote:
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*.
Rats. :/
I forgot to mention, but you can also create your own sheet provider (possibly derived from PSP) that creates sheets of the kind you want, and since all providers are able to receive the _objectAdding() event, you can have it happen as soon as the object knows it's being added, without even waiting for transaction commit. You would have to write such a provider in Python directly, however.
participants (2)
-
Bill Anderson -
Phillip J. Eby