[Zope] context in a Product's python code (not Python Script)

Dieter Maurer dieter@handshake.de
Thu, 5 Dec 2002 22:16:39 +0100


John Hohm writes:
 > ....
 > You seem to be saying that luck is required for a method to get proper
 > acquisition information.
That depends on what you mean with "proper".

  Apparently, the acquisition information passed into a method
  is proper for most applications (as there are very few complaints).


When I worked on my "References" product

  <http://www.dieter.handshake.de/pyprojects/zope>

I tried to pass full acquisition context into a method.
This resulted in a very expensive lookup process.
However, it well possible (even probable) that this was caused
by an error in my implementation.
I now emulate the context passing of "Acquisition".

 > How can this be?  Aren't methods acquired all over
 > the place?
Apparently, they usually do not need complete acquisition context
when they are acquired.

 > What alternatives to methods exist for defining objects that can
 > be acquired?
You use an object (more precisely "ExtensionClass" instance),
acquire it (it gets full acquisition context) and call
its methods (the self passed in has then full acquisition context).


Dieter