[mod_python] Returning a Apache return code

Daniele Cruciani crxop at tiscali.it
Tue Nov 30 11:10:34 EST 2004


Il giorno mar, 30-11-2004 alle 09:50 -0500, Golawala, Moiz M (GE
Infrastructure) ha scritto:
> Hi All,
> 
> I have am newbie and I seems to be having a problem return a different apache return code. In my httpd.conf file I am using PythonHandler mod_python.publisher. 
> 
> In my index.py file.
> 
> index(req):
> 	req.header_out['Location'] = "http://someurl:8080/
> 	return apache.HTTP_PERMANENTLY_MOVED

Maybe just asked try:

	req.headers_out['Location']="http://someurl:8080/"
        req.status=apache.HTTP_PERMANENTLY_MOVED
        raise apache.SERVER_RETURN, apache.HTTP_PERMANENTLY_MOVED

there should be something about in documentation too (why to raise to
apache).

Daniele.

> 
> my problem is that this returns:
> 
> HTTP/1.1 200 OK
> Date: Tue, 30 Nov 2004 01:12:06 GMT
> Server: Apache/2.0.49 (Fedora)
> Location:  "http://someurl:8080/"
> Connection: close
> Transfer-Encoding: chunked
> Content-Type: text/html; charset=UTF-8
> 
> 3
> 301
> 0
> 
> 
> I would like to return HTTP/1.1 301.. instead of HTTP/1.1 200 OK. 
> 
> For some reason anything that the method return the publisher handler puts it in the body of the request I cannot return a different return code other than the default apache.OK
> 
> Could some one please help me with this.
> 
> Thanks
> Moiz Golawala
> 
> _______________________________________________
> 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