Merge remote branch 'remotes/elrond/misc/i592_use_full_path'

This commit is contained in:
Christopher Allan Webber 2011-10-15 11:07:13 -05:00
commit f693f9af88
4 changed files with 14 additions and 3 deletions

View File

@ -118,6 +118,17 @@ class MediaGoblinApp(object):
path_info = request.path_info path_info = request.path_info
route_match = self.routing.match(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 ## Attach utilities to the request object
request.matchdict = route_match request.matchdict = route_match
request.urlgen = routes.URLGenerator(self.routing, environ) request.urlgen = routes.URLGenerator(self.routing, environ)

View File

@ -45,7 +45,7 @@ def require_active_login(controller):
return exc.HTTPFound( return exc.HTTPFound(
location="%s?next=%s" % ( location="%s?next=%s" % (
request.urlgen("mediagoblin.auth.login"), request.urlgen("mediagoblin.auth.login"),
request.path_info)) request.full_path))
return controller(request, *args, **kwargs) return controller(request, *args, **kwargs)

View File

@ -21,7 +21,7 @@
{# only display if {{pagination}} is defined #} {# only display if {{pagination}} is defined #}
{% if pagination and pagination.pages > 1 %} {% if pagination and pagination.pages > 1 %}
{% if not base_url %} {% if not base_url %}
{% set base_url = request.path_info %} {% set base_url = request.full_path %}
{% endif %} {% endif %}
{% if preserve_get_params %} {% if preserve_get_params %}

View File

@ -106,4 +106,4 @@ class Pagination(object):
This is a nice wrapper around get_page_url_explicit() This is a nice wrapper around get_page_url_explicit()
""" """
return self.get_page_url_explicit( return self.get_page_url_explicit(
request.path_info, request.GET, page_no) request.full_path, request.GET, page_no)