[Zope] PythonMethod and accessing objects in the ZODB

Dieter Maurer dieter@handshake.de
Tue, 7 Nov 2000 22:26:29 +0100 (CET)


Hannes Grund writes:
 > I'm using the PythonMethod product (latest Version) and Zope2.2.2.
 > The method lives inside a ZClass, which has an common instance 
 > propertysheet. Also the method gets an 'self' as argument.
 >   
 > Question 1:
 > How do i access the attributes stored within this propertysheet 
 > within the method,
 > while self.title and self.id gives the desired results. 
 > self.propertysheet.propertyname (among other experiments) 
 > raises an error.
There are API's for "PropertySheetManager" and "PropertySheets".
Use them for access.

 > Question 2:
 > How do I access objects stored elsewhere in the ZODB,
 > for example
 > self.REQUEST....path_to_object.object 
That looks a bit strange.

You can either access objects from self via acquisition:

    (e.g.) self.o.child 

or use the method "restricted_traverse" (--> API documentation).


Dieter