aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mediagoblin/app.py11
-rw-r--r--mediagoblin/decorators.py2
-rw-r--r--mediagoblin/templates/mediagoblin/utils/pagination.html2
-rw-r--r--mediagoblin/tools/pagination.py2
4 files changed, 14 insertions, 3 deletions
diff --git a/mediagoblin/app.py b/mediagoblin/app.py
index 0f25a4e5..f052d4a2 100644
--- a/mediagoblin/app.py
+++ b/mediagoblin/app.py
@@ -117,6 +117,17 @@ class MediaGoblinApp(object):
path_info = request.path_info
route_match = self.routing.match(path_info)
+ # By using fcgi, mediagoblin can run under a base path
+ # like /mediagoblin/. request.path_info contains the
+ # path inside mediagoblin. If the something needs the
+ # full path of the current page, that should include
+ # the basepath.
+ # Note: urlgen and routes are fine!
+ request.full_path = environ["SCRIPT_NAME"] + request.path_info
+ # python-routes uses SCRIPT_NAME. So let's use that too.
+ # The other option would be:
+ # request.full_path = environ["SCRIPT_URL"]
+
## Attach utilities to the request object
request.matchdict = route_match
request.urlgen = routes.URLGenerator(self.routing, environ)
diff --git a/mediagoblin/decorators.py b/mediagoblin/decorators.py
index 19e22bca..6431d67e 100644
--- a/mediagoblin/decorators.py
+++ b/mediagoblin/decorators.py
@@ -45,7 +45,7 @@ def require_active_login(controller):
return exc.HTTPFound(
location="%s?next=%s" % (
request.urlgen("mediagoblin.auth.login"),
- request.path_info))
+ request.full_path))
return controller(request, *args, **kwargs)
diff --git a/mediagoblin/templates/mediagoblin/utils/pagination.html b/mediagoblin/templates/mediagoblin/utils/pagination.html
index 0df3bfea..84336103 100644
--- a/mediagoblin/templates/mediagoblin/utils/pagination.html
+++ b/mediagoblin/templates/mediagoblin/utils/pagination.html
@@ -21,7 +21,7 @@
{# only display if {{pagination}} is defined #}
{% if pagination and pagination.pages > 1 %}
{% if not base_url %}
- {% set base_url = request.path_info %}
+ {% set base_url = request.full_path %}
{% endif %}
{% if preserve_get_params %}
diff --git a/mediagoblin/tools/pagination.py b/mediagoblin/tools/pagination.py
index 859b60fb..3ea96e6d 100644
--- a/mediagoblin/tools/pagination.py
+++ b/mediagoblin/tools/pagination.py
@@ -106,4 +106,4 @@ class Pagination(object):
This is a nice wrapper around get_page_url_explicit()
"""
return self.get_page_url_explicit(
- request.path_info, request.GET, page_no)
+ request.full_path, request.GET, page_no)