[Zope] PythonMethod and access

Evan Simpson evan@4-am.com
Thu, 30 Sep 1999 09:02:00 -0500


picasso@videotron.ca wrote:

> How can a PythonMethod access an arbitrary object stored in the ZODB.

The same way an External Method does; You have to pass the object (or at
least *some* starting object) as a parameter and go from there.  The
current namespace variable "_" is usually a good bet.

> ex:
> Myfolder
>     myObject
>     myPythonMethod
>     myDTMLMethod
>
> myDTMLMethod:
> <dtml-var "myObject.attribute">
>

<params>container</params>
return container.myObject.attribute

called as <dtml-var "pymethod(Myfolder)">

or

<params>_</params>
return _.myObject.attribute

called as <dtml-var "pymethod(_)">