RE: [Zope-dev] RE: [Zope] ZPatterns Question
At 10:28 AM 8/10/00 +0200, RC Compaan wrote: > >Oh ok, this divide clears it up a bit. I somehow imagined that an object's >properties are always stored inside the object and that Providers are the >managers of those properties. I am finding that most people outside of Digital Creations aren't aware that there's any other kind of property sheet besides the kind that stores its data in attributes. :( >The Specialist (filing clerk) asks its racks (filing cabinet) for an object >(dental records). The rack (filing cabinet) tells the object (the dental >records) that it belongs to the rack AND that the object should ask the rack >for anything it needs. > >Why would the object "need" anything. Is it not the specialist with the >"need"? > >If object data is stored external to the dataskin object does the dataskin >only implement behaviour? I find it difficult to understand because I >associate Dataskin with Storage. DataSkins do not implement storage; the whole point of a DataSkin is that it is storage-neutral. It is a behavioral "skin" which can be wrapped over other objects which actually implement behavior. It's a rather sophisticated variant of the GOF "Strategy" pattern, where an object delegates the choice of algorithm to another object. > If object data is stored externally is it >stored in Persistent Property Sheets? Well, that's one way to do it, and the only way implemented for you in ZPatterns currently. If you want to do it another way (e.g. SQL), you'll have to write your own sheet provider. >How does one define properties for >Persistent Property Sheets? By calling the standard propertysheet methods to manipulate their properties from code, e.g. manage_editProperties and the like. ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
RE: [Zope-dev] RE: [Zope] ZPatterns Question
> At 01:57 PM 8/8/00 +0200, RC Compaan wrote: > >I've added a propertysheet called "properties" to my ZClass and i notice > >there is Persistent Sheetprovider under the default rack already. The > >Sheetprovider has properties Sheet_Names and Sheet_Namespaces. I guess > >Sheet_Names should refer to the sheetname i created for my > ZClass??? but how > >do Sheet_Namespaces come into play. > > Actually, neither relates. Property sheets created on ZClasses > always have > their data stored in attributes of the object itself, so if you want to > control those property sheets you would not use a sheet provider at all. > Sheet providers are only used to provide property sheets whose data is > stored external to the object. > Oh ok, this divide clears it up a bit. I somehow imagined that an object's properties are always stored inside the object and that Providers are the managers of those properties. > The Specialist does not talk to the sheet provider. The Specialist asks > its racks for an object. The Rack which "retrieves" the object tells the > object that it belongs to the rack and should ask the rack for anything it > needs. When the object needs a property sheet or attribute or > whatever, it > asks the rack to give it a list of relevant providers for that > attribute/sheet/whatever. It then walks the list asking those > providers if > they can perform the function it desires. If none of the providers are > successful, it performs a default behavior (such as raising an > AttributeError to indicate the attribute does not exist). This general > pattern is followed for almost anything that can be delegated from a skin > to a provider. I considered the scenario where attributes are stored external to the object according to the filing clerk analogy on the wiki: The Specialist (filing clerk) asks its racks (filing cabinet) for an object (dental records). The rack (filing cabinet) tells the object (the dental records) that it belongs to the rack AND that the object should ask the rack for anything it needs. Why would the object "need" anything. Is it not the specialist with the "need"? If object data is stored external to the dataskin object does the dataskin only implement behaviour? I find it difficult to understand because I associate Dataskin with Storage. If object data is stored externally is it stored in Persistent Property Sheets? How does one define properties for Persistent Property Sheets? Roché ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] RE: [Zope] ZPatterns Question
Hi guys, I'm trying to make a simple guestbook using ZClasses and ZPatterns, I suppose this is somewhat overkill, and would be alot easier to do using SQL, but it's for the sake of knowledge (as is everything I do). So I read the IRC-log and asked a question regarding storing a ZClass in a Specialist/Rack, and I suppose that is what I should do too. Also note that I have not done anything with ZClasses or ZPatterns and take this as an oppotunity to learn booth ;). So I have done the following: I created a product and put 2 ZClasses in it, Guestbook and Guestbook_entry. Guestbook_entry was created with Dataskin as baseclass and holds a propertysheet called entry_data. Guestbook has 2 methods that handles the adding of entries, one is the form, the other is the actual dataadder (the forms action) and it's called entry_addProcessor. I then added a specialist to Guestbook, and told it to store Guestbook_entrys, it's called entry_storage. entry_addProcessor contains the following code: Code is supposed to go here... I just have to figure out how to add the data sent to newobj... But when I try to run this I get "Unauthorized" for newItem, and I don't know what settings to set for anonymous to be able to use it, since I can't seem to get it to work even with my user that has created everything. Now, am I correct to put the properties in the ZClass, or should they go into a PersistentSheet or a PersitentSheetProvider plugin? And if I should put it into PersistenSheets should I change anything in the Sheet_Names and Sheet_Namespaces boxes or just att my properties? And what about the Unauthorized error, should I change something in the define permissions tab? Now, if I could get this little question answered in english (not ZPatternish), I would be very happy, and if you get me to grasp these things I think quite a few others will grasp it too, and you will get less requests for basic dokumentation, and everyone will be happy and live long and prosper forever after. /Peter Toneby, who really should go to bed now. -- Alpha Test Version: Too buggy to be released to the paying public. Beta Test Version: Still too buggy to be released. Release Version: Alternate pronunciation of "Beta Test Version". ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] RE: [Zope] ZPatterns Question
At 01:57 PM 8/8/00 +0200, RC Compaan wrote: >I've added a propertysheet called "properties" to my ZClass and i notice >there is Persistent Sheetprovider under the default rack already. The >Sheetprovider has properties Sheet_Names and Sheet_Namespaces. I guess >Sheet_Names should refer to the sheetname i created for my ZClass??? but how >do Sheet_Namespaces come into play. Actually, neither relates. Property sheets created on ZClasses always have their data stored in attributes of the object itself, so if you want to control those property sheets you would not use a sheet provider at all. Sheet providers are only used to provide property sheets whose data is stored external to the object. The "name" refers to sheet names, yes, although again these are not ones created on the ZClass, which will be handled by the ZClass. The "namespaces" refers to the XML namespaces of the property sheets, which is a WebDAV thing. In the WebDAV protocol, "property sets" are added/changed using URLs as XML namespaces. So you could have a property sheet whose XML namespace is "http://www.zope.org/PTK/MemberProperties" and whose name is just "MemberProperties" or "MemberInfo" or something else altogether. ZPatterns supports WebDAV, and WebDAV requires the ability to add arbitrary property sets with arbitrary properties to an object. Also, the XML namespaces concept can be useful as a way of avoiding name collisions between frameworks. >>From the IRC_Chatlog: >"Call "getItem(key)" to retrieve an item from the Specialist, and >"newItem(key)" to create a new item in the specialist." > >Does this imply that I can simply call "newItem(key)" from a dtml-method >inside the specialist to create a new instance of my object? Yes. >I think I understand ZPattern architecture somewhat but get lost on the >implementation side, particularly at that place where attributes are >retrieved from storage or more clearly how a specialist(datamanager) links >up/communicates with a sheetprovider (data-plugin) and how the sheetprovider >in turn communicates with the rack and how the rack retrieves from storage >(dataskin). > >A very simple outline like this would help me a lot, eg: >Specialist to Sheetprovider (handled in IDE - add a SheetProvider under >Plugins) >Sheetprovider to rack (handled in IDE - select Storage Class under rack) >Rack to Dataskin () >Dataskin to physical storage () > >Roché > >PS: I would be more than willing to document my enlightenment in a howto The Specialist does not talk to the sheet provider. The Specialist asks its racks for an object. The Rack which "retrieves" the object tells the object that it belongs to the rack and should ask the rack for anything it needs. When the object needs a property sheet or attribute or whatever, it asks the rack to give it a list of relevant providers for that attribute/sheet/whatever. It then walks the list asking those providers if they can perform the function it desires. If none of the providers are successful, it performs a default behavior (such as raising an AttributeError to indicate the attribute does not exist). This general pattern is followed for almost anything that can be delegated from a skin to a provider. When DataSkins are used outside a rack, the process is similar, except that the DataSkin itself notices it is being retrieved from somewhere and has not been told it belongs to a rack, so it searches its acquisition path asking for a Customizer. Once found, it then uses the Customizer in the same way as it would have used the Rack (i.e. to ask for lists of providers that might be useful for performing tasks it needs done). ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] RE: [Zope] ZPatterns Question
I've added a propertysheet called "properties" to my ZClass and i notice there is Persistent Sheetprovider under the default rack already. The Sheetprovider has properties Sheet_Names and Sheet_Namespaces. I guess Sheet_Names should refer to the sheetname i created for my ZClass??? but how do Sheet_Namespaces come into play. >From the IRC_Chatlog: "Call "getItem(key)" to retrieve an item from the Specialist, and "newItem(key)" to create a new item in the specialist." Does this imply that I can simply call "newItem(key)" from a dtml-method inside the specialist to create a new instance of my object? I think I understand ZPattern architecture somewhat but get lost on the implementation side, particularly at that place where attributes are retrieved from storage or more clearly how a specialist(datamanager) links up/communicates with a sheetprovider (data-plugin) and how the sheetprovider in turn communicates with the rack and how the rack retrieves from storage (dataskin). A very simple outline like this would help me a lot, eg: Specialist to Sheetprovider (handled in IDE - add a SheetProvider under Plugins) Sheetprovider to rack (handled in IDE - select Storage Class under rack) Rack to Dataskin () Dataskin to physical storage () Roché PS: I would be more than willing to document my enlightenment in a howto > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of > Steve Alexander > Sent: 07 August 2000 06:19 > To: RC Compaan; [EMAIL PROTECTED] > Subject: Re: [Zope] ZPatterns Question > > > I've moved your question to zope-dev, as that's where ZPatterns > questions probably belong. > > Roche wrote: > > I created a ZClass called "Product" with Dataskin as baseclass. > > > > I also added a specialist called ProductManager containing a > default rack. > > Under storage for the rack I selected the newly created Product ZClass. > > > > My product ZClass needs to query both a RDBMS and the ZODB for > > attributevalues. At this point I get lost. > > I guess i should add an attributeprovider plug-in??? > > The easiest way is to use a couple of SheetProviders. Use a > PersistentSheetProvider for your ZODB values. You'll have to write your > own one for SQL values. > > You will need to create the appropriate propertysheets in your ZClass > class definition in your product. > > > What should go into the fromexpr and attrsexprs properties of the > > attributeprovider? Should one add an attributeprovider for > each attribute > > of the product? > > See the IRC chat log: > http://www.zope.org/Documentation/Chats/zpatt_chat_log An attribute provider can provide multiple attributes. You can have multiple attribute providers if you like. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Re: [Zope] ZPatterns Question
I've moved your question to zope-dev, as that's where ZPatterns questions probably belong. Roche wrote: > I created a ZClass called "Product" with Dataskin as baseclass. > > I also added a specialist called ProductManager containing a default rack. > Under storage for the rack I selected the newly created Product ZClass. > > My product ZClass needs to query both a RDBMS and the ZODB for > attributevalues. At this point I get lost. > I guess i should add an attributeprovider plug-in??? The easiest way is to use a couple of SheetProviders. Use a PersistentSheetProvider for your ZODB values. You'll have to write your own one for SQL values. You will need to create the appropriate propertysheets in your ZClass class definition in your product. > What should go into the fromexpr and attrsexprs properties of the > attributeprovider? Should one add an attributeprovider for each attribute > of the product? See the IRC chat log: http://www.zope.org/Documentation/Chats/zpatt_chat_log An attribute provider can provide multiple attributes. You can have multiple attribute providers if you like. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )