Great post Luciano! ..and very interesting diagrams. Interested in contributing to a new Zope zine/CDROM project? "A to ZOPE: A Zope Object Patterns Encyclopedia" The first thing I am looking for are people's true 'back-of-napkin' or whiteboard schematics. The ones they draw when they are really explaining, discussing or brainstorming Zope. Literally. These are typically dynamic sketches which grow over th course of an intense meeting, accompanied by suitable pointing, swapping of pens and talking. I want to render a set of these dynimically using Flash5 linked to a .zexp file, as a strong way to 'Visaully Think' Zope. I hope one result will be a useful resource for the Zope community, for clients, for devopers, for training. I am am happy to do the Flash programming , but what is missing right now are a collection of zopsitas raw drawings. I have my own 5x8 I use for all my work and keep as refernce. If your are interested please contact me and/or send me scans of any napkins! [originals welcome epsecially with authenticated coffee stains :-)] thanks ./Jason ___________________________________________________________ Jason CUNLIFFE = NOMADICS['Interactive Art and Technology'] ----- Original Message ----- From: "Luciano Ramalho" <luciano@hiper.com.br> To: <Bruce@EckelObjects.com> Cc: <zope@zope.org>; <chrism@digicool.com> Sent: Thursday, May 17, 2001 7:08 PM Subject: Re: [Zope] A corker
Bruce Eckel wrote:
Inside a DTML method that's called with an argument via acquisition (I may be misusing the term here), if the argument represents a DTML document name:
http://www.foobar.org/place/TheArgument/TheDTMLMethod
How do I
(1) get TheArgument from inside TheDTMLMethod (methinks PARENTS[0], but that seemed to be problematic) (2) Open the DTML document, once I have the argument
I think you are using aquisition in a very unusual manner. Don't think of the URL path elements as arguments, but as context for a method call. Zope is essentially an ORB that maps URLs to invocations of methods. Normally, everything in a Zope URL are objects, except the last element which maybe a method name or an object whose default method (usually index_html) will be invoked.
In your case, TheArgument should not be a string that you will use to fetch a document, but rather a reference to the document itself, upon which your method will operate. In other words, this:
http://www.foobar.org/place/TheArgument/TheDTMLMethod
is like this:
place.TheArgument.TheDTMLMethod()
So maybe you can say TheArgument is like the "self" argument, after all...
By putting TheArgument in the acquisition path, you acquire TheArgument's attributes, that is, its attributes are added to your namespace stack, where your method can access them directly.
Also, be careful not to confuse context with containment. The container of a method is the folder where it is statically located. The context of a method very often is the same as the container, but as you already know it may not be. The context is given by the acquisition path spelled out in the URL of the request.
In a recent tutorial, I used an altered version of an image from Grady Booch's OOAD book to explain acquisition. You can see it here:
http://www.hiperlogica.com.br/en/laboratorio/palestras/acquisition/img4.htm
Best regards,
Luciano