* looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-704 to compare with
* comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-704
M  MoinMoin/request.py

* modified files

--- orig/MoinMoin/request.py
+++ mod/MoinMoin/request.py
@@ -1699,12 +1699,41 @@
                 env=dict(req.subprocess_env)
             else:
                 env=req.subprocess_env
+            # Must be called BEFORE _setup_vars_from_std_env
+            self.fixScriptNameAndPathInfo(env)
             self._setup_vars_from_std_env(env)
             RequestBase.__init__(self)
 
         except error.FatalError, err:
             self.fail(err)
             
+    def fixScriptNameAndPathInfo(self, env):
+        """ Set script_name and path_info using httpd config
+        
+        When configuring using Apache <location> directive and path
+        like /a/b/c, the only way to set correct script_name and
+        path_info is to pass the required script_name using
+        PythonOption. See example configuration:
+        
+        <Location /url/to/mywiki>
+            PythonOption Location /url/to/mywiki      
+        </location>
+        
+        Must be called before self._setup_vars_from_std_env
+        """
+        location = self.mpyreq.get_options().get('Location')
+        if location is not None:
+            restoredURI = env['SCRIPT_NAME'] + env['PATH_INFO']
+            if not restoredURI.startswith(location):
+                message = '''Wrong "PythonOption Location %s".
+
+PythonOption Location value should match Apache Location directive. Fix
+and restart Apache.              
+''' % location
+                raise error.ConfigurationError(message)
+            env['SCRIPT_NAME'] = location
+            env['PATH_INFO'] = restoredURI[len(location):]
+
     def setup_args(self, form=None):
         """ Sets up args by using mod_python.util.FieldStorage, which
             is different to cgi.FieldStorage. So we need a separate



