[Zope] Interfaces to imported python modules

Dieter Maurer dieter@handshake.de
Thu, 24 Jul 2003 20:57:01 +0200


Matt wrote at 2003-7-24 17:04 +1200:
 > ... making objects accessible for TTW code ...
 > ...
 > If I had an instance of Data available to a python script, say 
 > called data, and I wanted to go
 > 
 > data.objectRefB.objectRefC.someMethod() 
 > 
 > where objectRefC is an attribute of the object that is the value of 
 > objectRefB,
 > 
 > then I also need to proxy that second object class so that it is 
 > available to the python script in Zope.

Provided your classes are true Python classes and not types
(implemented in "C"), then you do not need proxying but can
use a so called "monkey patch" to add the security declarations
at startup time to your classes.

Search "zope.org" for "monkey patch".

 > Is there any way to proxy only 
 > ObjectA and tell it to make public all interfaces of any object that can 
 > be referenced through it?  I can't seem to find information on the ZDG 
 > that suggests I can.

You could use dynamic proxying (something what "ExtensionClass"
and "Acquisition" does) but you probably do not want to do this.


Dieter