diff options
| author | Bas Peschier <bpeschier@bpeschier.nl> | 2015-03-22 20:04:31 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-26 09:26:55 -0400 |
| commit | 9128762f1608f9633005f16c95270058a50ada2b (patch) | |
| tree | bb16e0680b703904d40f57cb230eaba5afc05bc8 /django/http/request.py | |
| parent | 3e64f3d0fc285080b42b78b67565b6ed939f9a24 (diff) | |
Fixed #19910 -- Added slash to i18n redirect if APPEND_SLASH is set.
This introduces a force_append_slash argument for request.get_full_path()
which is used by RedirectFallbackMiddleware and CommonMiddleware when
handling redirects for settings.APPEND_SLASH.
Diffstat (limited to 'django/http/request.py')
| -rw-r--r-- | django/http/request.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/http/request.py b/django/http/request.py index 7989d064b6..97592b444a 100644 --- a/django/http/request.py +++ b/django/http/request.py @@ -99,11 +99,12 @@ class HttpRequest(object): msg += " The domain name provided is not valid according to RFC 1034/1035." raise DisallowedHost(msg) - def get_full_path(self): + def get_full_path(self, force_append_slash=False): # RFC 3986 requires query string arguments to be in the ASCII range. # Rather than crash if this doesn't happen, we encode defensively. - return '%s%s' % ( + return '%s%s%s' % ( escape_uri_path(self.path), + '/' if force_append_slash and not self.path.endswith('/') else '', ('?' + iri_to_uri(self.META.get('QUERY_STRING', ''))) if self.META.get('QUERY_STRING', '') else '' ) |
