Hi, How can a PythonMethod access an arbitrary object stored in the ZODB. ex: Myfolder myObject myPythonMethod myDTMLMethod myDTMLMethod: <dtml-var "myObject.attribute"> When I call it it return: "This is myObject attribute". Cheers... myPythonMethod: return myObject.attribute If I try it nothing happens! It seems I don't understand how namespaces work. Any help appreciated. *************************** Oscar Picasso picasso@videotron.ca ***************************
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(_)">
participants (2)
-
Evan Simpson -
picasso@videotron.ca