[Zope] Acquisition not working as expected

Roman Klesel roman_plonemail at lotuseyes.de
Fri Mar 3 04:26:47 EST 2006


Andrew Milton schrieb:
 > | <ul>
> |  <li tal:repeat="elem context/objectValues"
> |   <img tal:attributes="src string: ${elem/absolute_url}/genGraph"> plot </img>
> |  </li>
> | <ul>
> 
> In what way doesn't this work? I've certainly used this pattern in my FS
> products without problems.
>

Hmm? Did I miss something? A few posts above we recoginzed that when I would do:

def genGraph(self):
    "bla"
    return self.data

then genGraph would return data from the class where it is defined and not from the object acquiring it. So it would fail.

> | 'self' inside the a Zope product is the _same_ as 'context' or 'here' within
> | ZPT or PythonScripts.
> 
> It IS in the context of that object. However, if you call a method that is
> acquired, self in that method is the acquired object, not the acquiring object.
> 

Yes, this is what I understood (at least I think so) now. So the question is:

How will the method find out what object I want it to operate on if I call it in this way

context/genGraphs or objref/genGraphs

I actually want it to operate on the object I called it on, but this is not what self inside the method represents.

Roman


More information about the Zope mailing list