[Zope] PythonScripts and REQUEST, RESPONSE objects

Mayers, Philip J p.mayers@ic.ac.uk
Thu, 8 Mar 2001 16:39:09 -0000


Odd...

a) Try: print dtml_method(context,context.REQUEST) If validate is in =
the
REQUEST namespace, then context alone won't help. Context just contains =
the
acquisition tree.

b) is expected and normal behaviour.

c) context contains the acquisition tree (folder path) so if the DTML =
method
references anything else in the Zope hierarchy (other methods, headers, =
etc)
then not passing context will fail, as you've seen.

Regards,
Phil

+----------------------------------+
| Phil Mayers, Network Support     |
| Centre for Computing Services    |
| Imperial College                 |
+----------------------------------+ =20

-----Original Message-----
From: Stefan H. Holek [mailto:stefan@epy.co.at]
Sent: 08 March 2001 16:27
To: Mayers, Philip J; 'Wolfgang Strobl'; 'zope@zope.org'
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-announce
>  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 )