[mod_python] Changing the status code with custom content

Michael C. Neel neel at mediapulse.com
Tue Dec 23 09:46:25 EST 2003


Is req.status a 3.x only thing (reason I didn't see this is it's not
listed in the 2.x docs - and this server happens to be 2.x)?

Mike

> -----Original Message-----
> From: Gregory (Grisha) Trubetskoy [mailto:grisha at modpython.org] 
> Sent: Monday, December 22, 2003 7:43 PM
> To: Michael C. Neel
> Cc: mod_python at modpython.org
> Subject: Re: [mod_python] Changing the status code with custom content
> 
> 
> 
> I believe you should req.write() your error page, set 
> req.status to the
> the error code you want and return apache.OK. If you retrun 
> anything other
> then apache.OK, then Apache assumes you want it to send its own stock
> error page.
> 
> (Hope this answers your question, I'm a bit woozy on nuquil 
> right now....)
> 
> Grisha
> 
> On Mon, 22 Dec 2003, Michael C. Neel wrote:
> 
> > I'm having trouble using mod_python to change the status 
> code and have
> > custom content in the error message.  If I return something 
> other than
> > apache.OK in my handler, the status line is set correctly 
> set but apache
> > returns the default error page.  If I have sent custom 
> content for the
> > error message, the apache error message is added to the end of the
> > document.  I can get around this by using an ErrorDocument 
> directive in
> > apache's conf, but I loose access to the traceback of the 
> error and thus
> > the ability to have a really custom error message.
> >
> > At first glance this didn't seem to matter.  As long as the 
> content said
> > error, the user knew of the problem, even if the status was 200 OK.
> > However I've found out now with search bots this does matter - they
> > don't know that they have a bad url for the site and are 
> indexing error
> > pages thinking they are legit.
> >
> > Any thoughts on what I may be over looking?
> >
> > Thanks,
> > Mike
> >
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> 



More information about the Mod_python mailing list