[mod_python] Sugestion about publisher

Damjan arhiv at freemail.org.mk
Fri Jan 5 18:19:16 EST 2001


On Fri, Jan 05, 2001 at 11:02:35AM -0500, Rich Salz wrote:
> I can see the convenience of adding 'index.html' (hee hee :) to the
> end of nothing else is there.  Or rather, I can see how it is nice
> to mimic other behavior.  But the current hack is wrong.
> 
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, "/", ".")


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



More information about the Mod_python mailing list