[Zope] PythonScripts and REQUEST, RESPONSE objects

Wolfgang Strobl ws@mystrobl.de
Wed, 7 Mar 2001 22:21:29 +0100


On 7 Mar 2001, at 9:54, Chris Withers wrote:

> Yup, the following two lines at the start of your script: ;-)
> 
> REQUEST = context.REQUEST
> RESPONSE = context.REQUEST.RESPONSE
> 
> It'd be nice if Python Scripts did that for you, I wonder if there's
> any reason they don't?

I've a better idea. I added three lines (the else part):
<snip>
        if file:
            self._getOb(id).write(file)
        else:
            file ="from Products.PythonScripts.standard import 
html_quote\nREQUEST = context.REQUEST\nRESPONSE =  \
  context.REQUEST.RESPONSE\n"
            self._getOb(id).write(file)
<snip>

after line 124 in Pythonscript.py. Now each time I add a new 
PythonScript object, it starts with 

from Products.PythonScripts.standard import html_quote
REQUEST = context.REQUEST
RESPONSE = context.REQUEST.RESPONSE

If I don't need it, I just delete it.

-- 
Wolfgang Strobl