[Zope] context in Python Script
Chris Gray
cpgray@library.uwaterloo.ca
Tue, 28 Nov 2000 10:29:12 -0500 (EST)
I still can't get external Python Scripts to work as described in the Zope
Book. I am using the version of Python Scripts from the public
CVS. Internal Scripts work fine, but I can't seem to use the
"context" object in an external script.
def tryContext():
"""tryContext function"""
return context.objectIds()
gives a NameError on context.
----------
def tryContext(context):
"""tryContext function"""
return context.objectIds()
with the "Try It" tab, no form for passing parameters comes up and the
complaint is that the context parameter was omitted from the request.
-----------
<dtml-var tryContext>
to the first example above gives the same NameError on context and to the
second example gives "a not enough arguments" TypeError
-----------
It only seems to work when explicitly passing an argument like
<dtml-var "tryContext(this())">
but I thought that context was supposed to be bound to an object by
default as it is with an Internal Script.
Cheers,
Chris