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