diff pylons_app/lib/auth.py @ 508:fdb78a140ae4

fixes #35 hg-app does not respect SCRIPT_NAME
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 28 Sep 2010 02:31:10 +0200
parents a3d9d24acbec
children
line wrap: on
line diff
--- a/pylons_app/lib/auth.py	Mon Sep 27 03:13:05 2010 +0200
+++ b/pylons_app/lib/auth.py	Tue Sep 28 02:31:10 2010 +0200
@@ -255,10 +255,15 @@
             return func(*fargs, **fkwargs)
         else:
             log.warn('user %s not authenticated', user.username)
-
-            p = request.environ.get('PATH_INFO')
+            
+            p = ''
+            if request.environ.get('SCRIPT_NAME') != '/':
+                p += request.environ.get('SCRIPT_NAME')
+                
+            p += request.environ.get('PATH_INFO')
             if request.environ.get('QUERY_STRING'):
                 p += '?' + request.environ.get('QUERY_STRING')
+                
             log.debug('redirecting to login page with %s', p)                
             return redirect(url('login_home', came_from=p))