[Zope] Acquisition not working as expected
    Dieter Maurer 
    dieter at handshake.de
       
    Fri Mar  3 19:15:48 EST 2006
    
    
  
Roman Klesel wrote at 2006-3-3 10:26 +0100:
> ...
>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
It cannot.
It works for a PythonScript because in this case you acquire
an object (and not a method) and then call its method ("__call__").
The difference is that an object is acquired, not a method.
You can try to arrange things this way even with classes defined
in products:
   You define a new class "WC", derived from "Implicit".
   Its "__call__" method does, what you would like to happen.
   In "__call__", you access the acquisition context with
   "self.aq_parent".
   In your class "C", you instantiate "WC":
      test3 = WC()
   You can then acquire "test3" (it now is an object, no longer
   a method) and call it. In "test3.__call__", "self.aq_parent"
   will be the object, from which you acquired "test3".
-- 
Dieter
    
    
More information about the Zope
mailing list