[mod_python] req.write() in publisher_handler

Mateusz Korniak mateusz at ant.gliwice.pl
Fri Aug 16 23:35:56 EST 2002


On Friday 16 August 2002 23:31, Johannes Erdfelt wrote:
> On Fri, Aug 16, 2002, Mateusz Korniak <mateusz at ant.gliwice.pl> wrote:
> > 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 :(
>
> Are you sure that open call isn't causing any exceptions?
> Try commenting it out and testing.

Nope - it works the same with or wihout it
( I added it due Vio's suggestion).

> Also, are you restarting the server when you're testing?

I think it's not neccessary as I change main file of publisher handler - but 
to be absolutely sure - I do hard reset of apache after every change. Result 
remains same.

So it turns out that my apche/mod_python is broken ?

-- 
Mateusz Korniak
"Black holes are where God divided by zero." - Steven Wright




More information about the Mod_python mailing list