[mod_python] Re: req.write() in publisher_handler

Mateusz Korniak mateusz at ant.gliwice.pl
Sat Aug 17 00:59:51 EST 2002


On Saturday 17 August 2002 01:17, vio wrote:
> Try it like this:
>
> import mod_python.apache
> #from mod_python import apache
> pageA = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html><head><title>Test page</title></head>
> <body>  Page A <br>"""
> pageB = "Page B</body> </html>"
>
> def req_write(REQUEST):
>   REQUEST.status = mod_python.apache.OK
>   REQUEST.content_type = "text/html; charset=utf-8"
>   REQUEST.send_http_header()
>   REQUEST.write(pageA)
>   REQUEST.write(pageB)
>   raise mod_python.apache.SERVER_RETURN, mod_python.apache.OK

Yop :) raising  mod_python.apache.SERVER_RETURN instead of returning does the 
trick.

Also making req.write(d1)  ___and__ returning d2 sth sensible makes both 
(d1+d2) send to browser without error. I would guess that code runed after 
returning from handler gets confused by ""/None value returned by handler ...

-- 
Mateusz Korniak





More information about the Mod_python mailing list