Changes between Version 9 and Version 10 of ReplacingGetAbsoluteUrl
- Timestamp:
- Nov 7, 2008, 9:37:56 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ReplacingGetAbsoluteUrl
v9 v10 98 98 {{{ 99 99 #!python 100 from django.contrib.sites.models import Site 100 101 from django.conf import settings 101 102 import urlparse … … 110 111 except NotImplemented: 111 112 raise 112 # Should we look up a related site? 113 #if getattr(self._meta, 'url_by_site'): 114 prefix = getattr(settings, 'DEFAULT_URL_PREFIX', 'http://localhost') 115 return prefix + path 113 protocol = getattr(settings, "PROTOCOL", "http") 114 domain = Site.objects.get_current().domain 115 port = getattr(settings, "PORT", "") 116 if port: 117 assert port.startswith(":"), "The PORT setting must have a preceeding ':'." 118 return "%s://%s%s%s" % (protocol, domain, port, path) 116 119 get_url.dont_recurse = True 117 120