[Zope] PythonScripts and REQUEST, RESPONSE objects

Phil Harris phil.harris@zope.co.uk
Thu, 8 Mar 2001 16:35:33 -0000


Stefan

Sounds similar to something I did this morning.

Try this:

1.    add REQUEST, RESPONSE into the parameters textbox of your Python
Script.
2.    change print context.blahblah( _.None, _ ) to be print
context.blahblah( context, REQUEST )

See if that helps.

Phil
phil.harris@zope.co.uk


----- Original Message -----
From: "Stefan H. Holek" <stefan@epy.co.at>
To: "Mayers, Philip J" <p.mayers@ic.ac.uk>; "'Wolfgang Strobl'" <ws@gmd.d=
e>;
<zope@zope.org>
Sent: Thursday, March 08, 2001 4:26 PM
Subject: RE: [Zope] PythonScripts and REQUEST, RESPONSE objects


> Sorry Phil, this does not work for me in several ways:
>
> a) when I call any DTML Method from a Python Script with 'context' as
> the first parameter, I immediatley get
>         Error Type: AttributeError
>         Error Value: validate
> from the __call__
>
> b) I have to use         print context.blahblah( _.None, _ )
>         return printed
> to have anything output at all, and
>
> c) the called DTML Method does not aquire anything (possibly because I
pass _.None)
>
> Duh! I must be doing something wrong then...
>
> Stefan
>
> --
> Things work better when plugged in.
>
>
> --On Donnerstag, 08. M=E4rz 2001 11:20 +0000 "Mayers, Philip J"
> <p.mayers@ic.ac.uk> wrote:
>
> >   context.standard_html_{header,footer}(context,REQUEST)
> > > Or, if "_" is bound (called from DTML):
> > >   context.standard_html_{header,footer}(context,_)
> > > Could this please go in the manual and Zope book?
> > > Regards,
> > Phil
> > > +----------------------------------+
> > | Phil Mayers, Network Support     |
> > | Centre for Computing Services    |
> > | Imperial College                 |
> > +----------------------------------+  > > -----Original Message-----
> > From: Wolfgang Strobl [mailto:ws@gmd.de]
> > Sent: 08 March 2001 10:49
> > To: zope@zope.org
> > Subject: Re: [Zope] PythonScripts and REQUEST, RESPONSE objects
> > > > On 8 Mar 2001, 9:26  Chris Withers wrote:
> > >> > 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 =3D context.REQUEST
> >> > RESPONSE =3D context.REQUEST.RESPONSE
> >> >> Can you stick that in the Collector as a 'Feature w/patch'?
> > > Done. In addition as an afterhought,  I suggested adding two >
additional lines
> > > print "This is Script (Python) ",script.getId(),"("+script.title+")=
 at
> ",container.absolute_url()
> > return printed
> > > in analogy to the default content of DTML Methods.
> > > Btw, what's the correct way of rendering the default >
standard_html_header/footer from within a Python script? > > --
> >       o      (     Wolfgang.Strobl@gmd.de (+49 2241) 14-2394
> >      /\        *   GMD mbH                       #include >    _`\
`_<=3D=3D=3D      Schloss Birlinghoven,         <std.disclaimer>
> > __(_)/_(_)___.-._  53754 Sankt Augustin, Germany ________________
> > > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists - >  http://lists.zope.org/mailman/listinfo/zope-annou=
nce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
> > > _______________________________________________
> > Zope maillist  -  Zope@zope.org
> > http://lists.zope.org/mailman/listinfo/zope
> > **   No cross posts or HTML encoding!  **
> > (Related lists - >  http://lists.zope.org/mailman/listinfo/zope-annou=
nce
> >  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )