Django

Code

Show
Ignore:
Timestamp:
07/03/07 10:11:49 (2 years ago)
Author:
adrian
Message:

Fixed #4685 -- 'View on site' now works for https URLs. Thanks, cbrand@redback.com, treborhudson@gmail.com, Jeff Hilyard

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/views/defaults.py

    r5511 r5594  
    2222 
    2323    # If the object actually defines a domain, we're done. 
    24     if absurl.startswith('http://')
     24    if absurl.startswith('http://') or absurl.startswith('https://')
    2525        return http.HttpResponseRedirect(absurl) 
    2626 
     
    6262    # to whatever get_absolute_url() returned. 
    6363    if object_domain is not None: 
    64         return http.HttpResponseRedirect('http://%s%s' % (object_domain, absurl)) 
     64        protocol = request.is_secure() and 'https' or 'http' 
     65        return http.HttpResponseRedirect('%s://%s%s' % (protocol, object_domain, absurl)) 
    6566    else: 
    6667        return http.HttpResponseRedirect(absurl)