Commits

Marcin Kuzminski committed fdb78a1

fixes #35 hg-app does not respect SCRIPT_NAME

Comments (0)

Files changed (2)

pylons_app/controllers/summary.py

         c.repo_info = hg_model.get_repo(c.repo_name)
         c.repo_changesets = Page(list(c.repo_info[:10]), page=1, items_per_page=20)
         e = request.environ
-        uri = u'%(protocol)s://%(user)s@%(host)s/%(repo_name)s' % {
+            
+        uri = u'%(protocol)s://%(user)s@%(host)s%(prefix)s/%(repo_name)s' % {
                                         'protocol': e.get('wsgi.url_scheme'),
                                         'user':str(c.hg_app_user.username),
                                         'host':e.get('HTTP_HOST'),
+                                        'prefix':e.get('SCRIPT_NAME'),
                                         'repo_name':c.repo_name, }
         c.clone_repo_url = uri
         c.repo_tags = OrderedDict()

pylons_app/lib/auth.py

             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))