[Zope] Inserting headers and footers in response messages

Bruce Eckel Bruce@EckelObjects.com
Mon, 26 Nov 2001 07:33:34 -0800


Actually, you have to include arguments:
self.standard_html_header(self, self.REQUEST)

*********** REPLY SEPARATOR  ***********

On 11/25/01 at 11:31 PM Nitin Borwankar wrote:

>Bruce Eckel wrote:
>> 
>> Thanks, but python doesn't grok <dtml-var standard_html_header>
>> That looks like a couple of identifiers surrounded by less-than
and
>> greater than...
>
>
>Bruce,
>
>Sorry for some reason I thought you were in DTML.
>
>In Python do 
>
>....
>....
>
>return context.standard_html_header() + '''foo''' +
>context.standard_html_footer()
>
>as suggested at the end of my last message.
>
>I tried this in a Python script which I then invoked via the
"test" tab
>- renders as needed.
>Fails without the "()".
>
>
>Nitin Borwankar
>
>
>
>
>
>> 
>> *********** REPLY SEPARATOR  ***********
>> 
>> On 11/25/01 at 4:46 PM Nitin Borwankar wrote:
>> 
>> >Just guessing, but it would probably work if you did
>> >
>> >         self.REQUEST.RESPONSE.setHeader('content-type',
>> >           'text/html')
>> >           return <dtml-var standard_html_header>
>> >              + ''' <h1 color="red">Invalid email address:
>> >             please press your browser's 'back' key and correct
>> >             it</h1>'''
>> >             + <dtml-var standard_html_footer>
>> >
>> >i.e. quote only the <h1>...</h1> part but not the two
>> <dtml-var..>'s.
>> >I am guessing the quoting is preventing it from rendering.
>> >
>> >I am guessing again that the <dtml-var ...> will render inside
a
>> return
>> >statement just as it
>> >does outside it in a plain DTML document or method.
>> >
>> >Of course a Python script that does the needful ( ie invoke
>> >context.standard_html_header() + <h1> ...</h1> +
>> >context.standard_html_footer() )
>> >could be written and then invoked from inside the return
>> statement.
>> >This way it will render inside the Python script.
>> >If you want to parametrise the method, pass in the <h1>...</h1>
>> stuff as
>> >a string parameter.  This will effectively give you a Python
>> script that
>> >puts the standard header/footer around any message you want.
>> >
>> >
>> >Nitin Borwankar.
>> >nitin@borwankar.com
>> >
>> >
>> >
>> >
>> >>
>> >> Most current information can be found at:
>> >> http://www.mindview.net/Etc/notes.html
>> >> ===================
>> >> Bruce Eckel    http://www.BruceEckel.com
>> >> Contains free electronic books: "Thinking in Java 2e" &
>> "Thinking
>> >> in C++ 2e"
>> >> Please subscribe to my free newsletter -- just send any email
>> to:
>> >> join-eckel-oo-programming@earth.lyris.net
>> >> My schedule can be found at:
>> >> http://www.mindview.net/Calendar
>> >> ===================
>> >>
>> >> _______________________________________________
>> >> 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 )
>> >
>> >--
>> > --
>> > Nitin Borwankar
>> > nitin@borwankar.com
>> 
>> Most current information can be found at:
>> http://www.mindview.net/Etc/notes.html
>> ===================
>> Bruce Eckel    http://www.BruceEckel.com
>> Contains free electronic books: "Thinking in Java 2e" &
"Thinking
>> in C++ 2e"
>> Please subscribe to my free newsletter -- just send any email
to:
>> join-eckel-oo-programming@earth.lyris.net
>> My schedule can be found at:
>> http://www.mindview.net/Calendar
>> ===================
>
>-- 
> --
> Nitin Borwankar
> nitin@borwankar.com



Most current information can be found at:
http://www.mindview.net/Etc/notes.html
===================
Bruce Eckel    http://www.BruceEckel.com
Contains free electronic books: "Thinking in Java 2e" & "Thinking
in C++ 2e"
Please subscribe to my free newsletter -- just send any email to:
join-eckel-oo-programming@earth.lyris.net
My schedule can be found at:
http://www.mindview.net/Calendar
===================