[Zope] Acquisition not working as expected

Andrew Milton akm at theinternet.com.au
Fri Mar 3 04:42:10 EST 2006


+-------[ Roman Klesel ]----------------------
| 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.

How about you forget about Acquisition for now.

Define the method in the class you want to call it on.

Once you're happy with the way that works, you can use Acquisition to keep
things like state or configuration for a particular path.

If you CAN'T define the method in the class (not sure why you couldn't), then
you will have to define a method and pass an instance or a reference.

-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list