The REQUEST object can be accessed from the bound names context and container in a Python Script. For instance, if you passed a Python Script the Form variable foo, you could access it like so: print "Foo is " + context.REQUEST['foo'] print "An object of type %s named %s called a script named %s." % (context.meta_type, context.id, script.id) print "This script lives in the folder " + container.id return printed The RESPONSE object is part of the REQUEST object and could be called like this: context.REQUEST.RESPONSE.redirect('http://www.zope.org')
whenever a pythonscript needs to invoke objects like REQUEST or RESPONSE, I have to put those objects at the paramter list and then, when invoking the pythonscript I have to pass those objects to it.
This brings me 2 problems: the syntax is much longer, instead of having: <dtml-var MyMethod> I have to type now: <dtml-var "MyMethod(RESPONSE=RESPONSE , REQUEST=REQUEST)">
the other problem is that from now on this object requires to be called from a dtml-method (because it needs these RESPONSE and REQUEST objects as parameters)
is there a cleaner solution than doing this?
Yup :) Kevin Teague http://www.bud.ca