[Zope] Couple of newbie questions

Paul Winkler pw_lists@slinkp.com
Wed, 18 Dec 2002 15:35:43 -0800


On Thu, Dec 19, 2002 at 10:06:30AM +1100, pskipworth@touchcorp.com wrote:
> Hi all,
> 
> Couple of quickies...
> 
> 1) How do I reference a Script (Python) from an External Method ? I have 
> an external method which needs to call a Script (Python), both of which 
> are in the same folder - following is my external method - the " c = 
> ..." line is wrong, but I don't know how to fix it!
> 
> def export(self):
> 
>     request = self.REQUEST
>     response =  self.REQUEST.RESPONSE
> 
>     c = self.aq_parent.getClients();

Try it like

    c = self.getClients()

The "self" in an External Method can be used like "context"
in a Script (Python).

> 2) What exactly does 'container' reference ? How is it different to 
> aq_parent ? Can someone give a couple of examples of usage of them ?

self.aq_parent is the context's parent in the acquisition chain.
So it involves the calling context as well as the containers,
depending on how the method is called. 

container in a script means the container where the script actually
lives, so it's not affected by context at all.

-- 

Paul Winkler
http://www.slinkp.com
"Welcome to Muppet Labs, where the future is made - today!"