[mod_python] Sugestion about publisher

Damjan arhiv at freemail.org.mk
Sat Jan 6 00:05:10 EST 2001


> Ok. How about this:
> 
> --- publisher.py.old    Mon Jan  1 21:48:04 2001
> +++ publisher.py        Fri Jan  5 18:16:34 2001
> @@ -81,7 +81,11 @@
> 
>      # get the path PATH_INFO (everthing after script)
>      if not _req.subprocess_env.has_key("PATH_INFO"):
> -        raise apache.SERVER_RETURN, apache.HTTP_NOT_FOUND
> +        loc = 'http://' + _req.connection.server.server_hostname
> +        loc = loc + ':' + str(_req.connection.server.port)
> +        loc = loc + _req.uri + '/index_html'
> +        _req.headers_out['Location'] = loc
> +        raise apache.SERVER_RETURN, apache.HTTP_MOVED_PERMANENTLY
> 
>      func_path = _req.subprocess_env["PATH_INFO"][1:] # skip fist /
>      func_path = string.replace(func_path, "/", ".")

Hmmm. 
I found a strange thing in mod_python, while playing with this patch.
The situation is this:
if you type a URL of a with a trailling '/' you get that
req.subprocess_env.["PATH_INFO"] doesn't exist but req.pathinfo is '/'.
Why is   req.subprocess_env.["PATH_INFO"] != req.pathinfo ??

-- 
Damjan Georgievski		|           Дамјан Георгиевски
Skopje, Macedonia		|           Скопје, Македонија



More information about the Mod_python mailing list