aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/views.py
diff options
context:
space:
mode:
authorTom Christie2012-01-04 01:42:05 -0800
committerTom Christie2012-01-04 01:42:05 -0800
commit65e324bc1960506d3c0063af4295b464470b19b4 (patch)
tree4e241c046fdf6e40fd8c848477567515ec989b19 /djangorestframework/views.py
parentccbb53689632cade44a33b67ff5f87f0d37b22c7 (diff)
parent7b6c56a73bf10f02cd616dd52a30721635d71429 (diff)
downloaddjango-rest-framework-65e324bc1960506d3c0063af4295b464470b19b4.tar.bz2
Merge pull request #108 from mjumbewu/patch-1
Only set the script_prefix if the prefix isn't already a full URL.
Diffstat (limited to 'djangorestframework/views.py')
-rw-r--r--djangorestframework/views.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/djangorestframework/views.py b/djangorestframework/views.py
index 4cc2c7cb..4606e50b 100644
--- a/djangorestframework/views.py
+++ b/djangorestframework/views.py
@@ -115,8 +115,9 @@ class View(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, DjangoView):
# Calls to 'reverse' will not be fully qualified unless we set the scheme/host/port here.
orig_prefix = get_script_prefix()
- prefix = '%s://%s' % (request.is_secure() and 'https' or 'http', request.get_host())
- set_script_prefix(prefix + orig_prefix)
+ if not (orig_prefix.startswith('http:') or orig_prefix.startswith('https:')):
+ prefix = '%s://%s' % (request.is_secure() and 'https' or 'http', request.get_host())
+ set_script_prefix(prefix + orig_prefix)
try:
self.initial(request, *args, **kwargs)