[mod_python] Stopping additional error content

Gregory (Grisha) Trubetskoy grisha at modpython.org
Wed Apr 16 23:10:57 EST 2003


I think something like this should work (this is off the top of my head,
it's possible I'm missing something):

	req.status = apache.HTTP_FORBIDDEN
	req.write("Cannot do this because of some problem")
	return apache.OK

Grisha

On Thu, 17 Apr 2003, Robert Leftwich wrote:

> 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>!
>
> Robert
>
> 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?
>
>
>
>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://www.modpython.org/mailman/listinfo/mod_python
>




More information about the Mod_python mailing list