diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-23 17:28:12 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-23 17:28:12 +0000 |
| commit | 646f2f6101cda3e20908928de44739dfff596b0f (patch) | |
| tree | 81b62d46bd133d9850867e626fc95e6d03365ad3 /django/http | |
| parent | 3dd69a965b467a3085079a3628b18310a10f0261 (diff) | |
Fixed #7494 -- Fixed build_absolute_url() for some types of (uncommon) URLs.
Patch from tom@almostobsolete.net and RobotAdam.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8490 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/http')
| -rw-r--r-- | django/http/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/http/__init__.py b/django/http/__init__.py index bbbd1ba99a..6d24e0a23a 100644 --- a/django/http/__init__.py +++ b/django/http/__init__.py @@ -1,4 +1,5 @@ import os +import re from Cookie import SimpleCookie, CookieError from pprint import pformat from urllib import urlencode @@ -18,6 +19,8 @@ from utils import * RESERVED_CHARS="!*'();:@&=+$,/?%#[]" +absolute_http_url_re = re.compile(r"^https?://", re.I) + class Http404(Exception): pass @@ -65,7 +68,7 @@ class HttpRequest(object): """ if not location: location = self.get_full_path() - if not ':' in location: + if not absolute_http_url_re.match(location): current_uri = '%s://%s%s' % (self.is_secure() and 'https' or 'http', self.get_host(), self.path) location = urljoin(current_uri, location) |
