[Zope-dev] RE: ZPatterns, ObjectDomain, UML and all that.....
Hi Steve I'm also a babe in the woods when it comes to object modelling, but here's my pennie's worth. Since code generation was not really required in the models I recently did for Zope Apps and the terrible exchange rate on the South African Rand I decided to use to very light weight Playground modelling tool. I agree with Steve Alexander that Coad notation serves ZPatterns *better* and this is exactly what Playground uses. If I explicitly store a Bar object as an Attribute of a DataSkin then what happens if the original Bar is removed from its Specialist's Rack? Does the Bar I store still refer to the original Rack as its DataManager? So.. does a Rack sometimes have 'clients' that are not really in the Rack at all? Or perhaps I misunderstood the discussion, and the Address wasn't really a DataSkin at all? Also.. assuming that all works, do I have to do anything special, or carefully to be sure that the persistence machinery doesn't incur lots of expensive attribute fetching if I don't explicitly refer to those attributes, but have the DataSkin as a directly set attribute of another DataSkin? Before I started building Apps with ZPatterns I built a object/relational access layer in Delphi for my applications which enables me to create pure objects in my problem domain and delegate all data management to the the access layer. I *think* this is one of the things ZPatterns wants to do as well. Take the Customer with Address property example: I create Customer and Address Dataskins. For Customer I have an external method setAddress which sets the Address property of my Customer object and this is how I would create a new Customer: newCustomer = customerRack.newItem( CustomerCounter ) newAddress = addressRack.newItem( AddressCounter ) newCustomer.setAddress( newAddress ) I prefer the simplicity this brings when I have to access the properties of a Customer (without having to call a getter each time I need an address): myCustomer.Address.Street This also maps quite simply to SQL storage. So although instances of Address are properties of Customer they live on their own Rack and instances of Customer simply refers to their Address through assignment. With Container/Content type objects I do roughly the same - I have setContainer methods for the Content objects. 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 )
[Zope] RE: How to Delete ZClass Instances programmatically??
Instead of directing your form to URL0 direct it back to your custom interface. In your form you can evaluate the value of submit to determine the appropriate action: dtml-if "REQUEST['submit'] == 'Delete'" dtml-call "manage_delObjects(ids)" untested. Roché -Original Message- From: Jean Jordaan [mailto:[EMAIL PROTECTED]] Sent: 28 August 2000 01:43 To: '[EMAIL PROTECTED]' Cc: RC Compaan (E-mail) Subject: How to Delete ZClass Instances programmatically?? Hi Zopers I've found the "How-To: Adding ZClass Instances Programmatically", but now I'm looking for the *Deleting ZClass Instances* one! I'm trying this as a beginning (hacked from the Zope management interface):: dtml-if "AUTHENTICATED_USER.has_role('ContentManager')" form action="dtml-var URL0" method="post" /dtml-if [...] dtml-if "AUTHENTICATED_USER.has_role('ContentManager')" input type="checkbox" name="ids:list" value="dtml-var id" /dtml-if [...] dtml-if "AUTHENTICATED_USER.has_role('ContentManager')" input type="submit" name="manage_delObjects:method" value="Delete" /form /dtml-if Problems: - it sends me to the management screen afterwards, and I'm calling it from the public interface. - I don't necessarily want to give the 'ContentManager' rights to delete objects; I'd rather manage this through a delete method with the appropriate proxy role. Any advice or RTFM pointers? -- Jean Jordaan --technical writer-- Mosaic Software--Zope 2.1.6 on WinNT and W2K ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
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 )
[Zope] RE: About Squishdot and permissions
Check if the proxy role for index_html is set to manager. roché -Original Message- From: Jean Jordaan [mailto:[EMAIL PROTECTED]] Sent: 08 August 2000 01:02 To: RC Compaan (E-mail); '[EMAIL PROTECTED]' Subject: About Squishdot and permissions hi Zopers, In case this is very obvious (I'm RTFM'ing meantime) .. while hacking Squishdot's DTML, I did something to make 'leftbox_items' inaccessible to 'Anonymous': Unauthorized You are not authorized to access leftbox_items. in / , Anonymous has these permissions: Access contents information Add Comments Add Newss Add Postings Add ZWiki Pages Change ZWiki Pages Search ZCatalog Use Database Methods View any clue what's up? -- jean (running Zope 2.1.6 and Squishdot-0-4-1) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] ZPatterns Question
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??? What should go into the fromexpr and attrsexprs properties of the attributeprovider? Should one add an attributeprovider for each attribute of the product? Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Precondition
What does the "Precondition" property of the file class refer to? Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] RE: How to prime a selection?
Hi Jean The value for a selection list can be any zope object that returns a list eg. MyDocClass can have a property "Format" with a value "FormatList", where FormatList is a dtml-method that returns a list. Practically: 1.Go to the property sheet for your new class and add the property Format with value FormatList. 2.Go to the Folder where you want to add an instance of your ZClass and create add a property "docformats" of type "lines" and enter the initial formats. 3.In the Folder where you want to add your instance, create a dtml-method called "FormatList" that will return the list, containing: dtml-return docformats Hope this helps. For more info on selection list see http://www.zope.org/Members/AlexR/SelectionLists Roché -Original Message- From: Jean Jordaan [mailto:[EMAIL PROTECTED]] Sent: 04 August 2000 07:10 To: '[EMAIL PROTECTED]' Cc: RC Compaan (E-mail) Subject: How to prime a selection? Hi all I'm making a document class for a warehouse of papers. It's based on ZCatalogAware and ObjectManager (to wrap mainly PDFs and DOCs), and has fields: title (string type) origin (string type) format No value for format_value. typeNo value for type_value. "format" and "type" are selections -- 1. where do I supply their initial values (filling in 'format_value' and 'type_value')? 2. is it possible to let a field offer presets and previously entered values, but to allow users to add new ones, which are remembered and offered to subsequent users? A RTFM-type answer to question 1. is perfectly OK, though a page reference would be sorely appreciated. -- jean ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] Zope Components and ZPatterns
Thanks Holger I used the source distribution and it worked. Why is this not part of the binary distribution? Roché -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Holger Hoffmann Sent: 17 July 2000 05:43 To: RC Compaan Subject: Re: [Zope] Zope Components and ZPatterns Hi, RC Compaan wrote: In trying to install ZPatterns on linux the install fails during the "make" part of the install, complaining about a non-existant ExtensionClass.h, which should be in the Zope Components directory (also not existent). I [snip] i think you need the source distribution of zope. There the file ExtensionClass.h exists in lib/Components/ExtensionClass. ... Holger ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] Zope Components and ZPatterns
And no source is distributed with the binary distro? It seems harless to include the zope components into the binary distro. Roché -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Bill Anderson Sent: 18 July 2000 10:40 To: RC Compaan Cc: Zope Subject: Re: [Zope] Zope Components and ZPatterns RC Compaan wrote: Thanks Holger I used the source distribution and it worked. Why is this not part of the binary distribution? Because it is source :-) -- Do not meddle in the affairs of sysadmins, for they are easy to annoy, and have the root password. ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Zope Components and ZPatterns
In trying to install ZPatterns on linux the install fails during the "make" part of the install, complaining about a non-existant ExtensionClass.h, which should be in the Zope Components directory (also not existent). I noticed on the mailing list that one should do a rebuild if you install from the source. I ran the install script that comes with the source but still no Components directory is created and no ExtensionClass.h is to be found. Where do I go wrong? Waiting for ZPattern-magic Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Sorting a list
I have a list: mylist=[('R',31),('I',80),('A',80),('S',23),('E',35),('C',21)] I want to rebuild the list sorted from high to low on the sequence-item. When i call dtml-in mylist sort=sequence-item reverse the list gets sorted on the sequence-key not the sequence-item. As I understand the alphabetical characters are the sequence-keys and the float values are the sequence-items. Where do misunderstand? Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] ProxyPass
Thanks Pierre This is a relief, I really didn't want to switch back to pcgi. I have worked a little bit with the rewritemodule but if anybody has an example on how to do this it would really be helpfull. Roché use the rewriterule module, with the [P] flag this is very powerfull (a little hard to use, but...) and u can do what u want with URLs (doc on Apache site), and u can use Apache as a proxy server much more powerfull (it looks like I like this word ;^) ). Pierre Is there anyway to get around the fact that the remote ip is the server's ip if you use Apache's ProxyPass directive to pass requests on to Zope? Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] ProxyPass
Is there anyway to get around the fact that the remote ip is the server's ip if you use Apache's ProxyPass directive to pass requests on to Zope? Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] PropertyIds
I have a very simple documentclass in very simple structure in method that should return the properties of the document: dtml-call "REQUEST.set('tid', REQUEST.cookies['careermanid'])" dtml-with RESULTS // RESULTS is a ZClass Object Manager dtml-call "REQUEST.set('tmp', _.getitem(_['tid']))" // tmp is a document with an id equal to the cookie dtml-return "tmp.propertyIds" /dtml-with During the application i add properties to the document and want to display them with the above method. The Property ids does not get shown though. I've tried: dtml-with tmp dtml-var propertyIds /dtml-with and also: dtml-in "tmp.propertyIds" dtml-return sequence-item /dtml-with But no luck. How can this work? Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] PropertyIds
Thanks Rik it works. I've noticed in some cases that one puts empty brackets at the end of certain zope object methods. Is that there for methods that can take parameters? Roché -Original Message- From: Rik Hoekstra [mailto:[EMAIL PROTECTED]] Sent: 19 June 2000 12:54 To: RC Compaan Cc: Zope Subject: Re: [Zope] PropertyIds I have a very simple documentclass in very simple structure in method that should return the properties of the document: dtml-call "REQUEST.set('tid', REQUEST.cookies['careermanid'])" dtml-with RESULTS // RESULTS is a ZClass Object Manager dtml-call "REQUEST.set('tmp', _.getitem(_['tid']))" // tmp is a document with an id equal to the cookie dtml-return "tmp.propertyIds" this line should read: dtml-var "tmp.propertyIds()" Two things going wrong: 1. the dtml-return tag is for DTML Methods that should just return something. You want dtml-var. 2. you call propertyIds in an expression (the line is shorthand for dtml-var expr="tmp.propertyIds()" - in that case you have to call it as a function. /dtml-with During the application i add properties to the document and want to display them with the above method. The Property ids does not get shown though. I've tried: dtml-with tmp dtml-var propertyIds /dtml-with this should get you a list, like ['title', 'prop1, ...] and also: dtml-in "tmp.propertyIds" dtml-return sequence-item /dtml-with this doesn't work for reasons outlined above. Rik ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
RE: [Zope] PropertyIds
Very clear, thanks. Really appreciated. Well i guess the topic was never about propertyids, but i can only tell that now. Still working with properties i find the following trouble. dtml-var "MyDoc.propertyItems()" returns a list of key-value pairs [('Key1','Value1'},('Key2','Value2')] to access the values of each key sequentially i tried: dtml-in "MyDoc.propertyItems()" dtml-let s="_['sequence-item']" key=s[:1] value=[1:] dtml-var key:dtml-var valuebr /dtml-in But this just returns "k" and "ey" resulting in a slice of the keyname. Roché Thanks Rik it works. I've noticed in some cases that one puts empty brackets at the end of certain zope object methods. Is that there for methods that can take parameters? [rh]Um, not quite, it has to do with the way of calling the object methods in question. DTML has two ways of calling: by name and through expressions. 1. The 'normal' Zope way of writing things is dtml-var objectValues. This is shorthand for dtml-var name="objectValues". 2. The other way is dtml-var "objectValues". This is shorthand for dtml-var expr="objectValues". Everything inside the expression is treated as a python expression. If you call it without the brackets, you're just referencing the method. If you try that in a DTML Method and look in the source of the diplayed document you'll see something like Python Method object at 13fcbf0. If you want to _call_ the method, you'll have to add the brackets (with or without arguments). Hope this is clear. Rik ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Expressing expressions
Simple addition seems a bit tricky in zope dtml-call "REQUEST.set('CategoryTotal',0)" dtml-in "tmp.propertyItems()" dtml-let key="_['sequence-key']" value="_['sequence-item']" category="s[:1]" counter="_.getitem(category+'Total')" --// Here i want to concatenate the category from the value with the word total so that i can lookup my declared variable in the namespace. dtml-var expr="counter=counter+value" --// Here i tried to increase the declared variable with the value. /dtml-let /dtml-in Can someone help? Roché ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )