[mod_python] req.write() in publisher_handler

Mateusz Korniak mateusz at ant.gliwice.pl
Fri Aug 16 23:30:04 EST 2002


On Friday 16 August 2002 23:25, Johannes Erdfelt wrote:
> On Fri, Aug 16, 2002, Mateusz Korniak <mateusz at ant.gliwice.pl> wrote:
> > On Friday 16 August 2002 22:58, vio wrote:
> > > * Mateusz Korniak <mateusz at ant.gliwice.pl> [020816 15:26]:
> > > > Yes. But what in publisher handler case ?
> > > > Can you use req.write() instead of returning page ?
> > > > I get Internal server error in that case ... :(
> > >
> > > I don't quite understand your question. req.write() IS the returning
> > > page. But I think I know where the bobo is: it's the Internal server
> > > error message.
> >
> > So let me be ( I hope) much more clear: Below my publisher handler:
> >
> > import mod_python.apache
> > page = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <html><head><title>Test page</title></head>
> > <body> Test </body> </html>"""
> >
> > def req_write(req):
> > 	req.status = mod_python.apache.OK
> > 	req.content_type = "text/html; charset=utf-8"
> > 	req.send_http_header()
> > 	req.write(page)
> > 	open("/tmp/marker","w") # Test if we have exceptions
> > 		#before returning from handler
>
> 	return ""
>
> Add that.
>
In my enviroment it doesn't change a thing :(

-- 
Mateusz Korniak





More information about the Mod_python mailing list