[mod_python] Stopping additional error content

Robert Leftwich robert at leftwich.info
Thu Apr 17 12:04:31 EST 2003

Is it possible to stop mod_python appending html error information when a 
4xx error code is returned from a handler? For example I want to return 
some simple text  from my handler containing the application error message, 
but mod_python adds a bunch of html that I do not want to be returned, i.e.

         if [some problem]:
             req.content_type = "text/plain"
             req.write("Cannot do this because of some problem")
             return apache.HTTP_FORBIDDEN

The client s/w ends up seeing the above message plus a bunch of html 
including a <title>200 OK</title>!


PS I'm wondering if my other problem (Content-Location) is related to this 
one, i.e. apache/mod_python is seeing the HTTP_FORBIDDEN or HTTP_CREATED 
and is doing its own (default?) thing and adding/changing the returned result?

More information about the Mod_python mailing list