[mod_python] Stopping additional error content

Robert Leftwich robert at leftwich.info
Thu Apr 17 13:30:24 EST 2003

At 01:10 PM 17/04/2003, Gregory (Grisha) Trubetskoy wrote:

>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

Works perfectly, thanks!

Note that it also solves my other problem with the Content-Location, i.e. 
if I do :

def handler(req):
     if req.method == 'POST':
         req.headers_out["Content-Location"] = "/foo/bar"
         req.status = apache.HTTP_CREATED
         return apache.OK

then the Content-Location is received correctly by the client.

Thanks a lot!


More information about the Mod_python mailing list