summaryrefslogtreecommitdiff
path: root/django/views/defaults.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-07-03 15:11:49 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-07-03 15:11:49 +0000
commitc7b49792f4de416c903965ff5d029a566b8d7ef8 (patch)
treeaf0d0ec16f56674bb778f121f35a8dc408ec423d /django/views/defaults.py
parentee7fe94d45150fad2c90a16ae23034a8bba98efd (diff)
Fixed #4685 -- 'View on site' now works for https URLs. Thanks, cbrand@redback.com, treborhudson@gmail.com, Jeff Hilyard
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5594 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/views/defaults.py')
-rw-r--r--django/views/defaults.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/views/defaults.py b/django/views/defaults.py
index 701aebabd6..b4dfc1e1eb 100644
--- a/django/views/defaults.py
+++ b/django/views/defaults.py
@@ -21,7 +21,7 @@ def shortcut(request, content_type_id, object_id):
# if necessary.
# If the object actually defines a domain, we're done.
- if absurl.startswith('http://'):
+ if absurl.startswith('http://') or absurl.startswith('https://'):
return http.HttpResponseRedirect(absurl)
object_domain = None
@@ -61,7 +61,8 @@ def shortcut(request, content_type_id, object_id):
# If all that malarkey found an object domain, use it; otherwise fall back
# to whatever get_absolute_url() returned.
if object_domain is not None:
- return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
+ protocol = request.is_secure() and 'https' or 'http'
+ return http.HttpResponseRedirect('%s://%s%s' % (protocol, object_domain, absurl))
else:
return http.HttpResponseRedirect(absurl)