Ticket #634: shortcut-fix.diff

File shortcut-fix.diff, 1.1 KB (added by hugo, 19 years ago)

fixes admin shortcuts to honor leading http://

  • views/defaults.py

     
    1212        raise Http404, "Content type %s object %s doesn't exist" % (content_type_id, object_id)
    1313    if not hasattr(obj, 'get_absolute_url'):
    1414        raise Http404, "%s objects don't have get_absolute_url() methods" % content_type.name
     15    absurl = obj.get_absolute_url()
     16    if absurl.startswith('http://'):
     17        return httpwrappers.HttpResponseRedirect(absurl)
    1518    object_domain = None
    1619    if hasattr(obj, 'get_site_list'):
    1720        site_list = obj.get_site_list()
     
    2730    except sites.SiteDoesNotExist:
    2831        pass
    2932    if not object_domain:
    30         return httpwrappers.HttpResponseRedirect(obj.get_absolute_url())
    31     return httpwrappers.HttpResponseRedirect('http://%s%s' % (object_domain, obj.get_absolute_url()))
     33        return httpwrappers.HttpResponseRedirect(absurl)
     34    return httpwrappers.HttpResponseRedirect('http://%s%s' % (object_domain, absurl))
    3235
    3336def page_not_found(request):
    3437    """
Back to Top