Browse Source

web/jump/views.py: render jump.html template when redirecting

Following "Jump service implementation hints" by zzz:
http://zzz.i2p/topics/740
pull/1/head
Hidden Z 14 years ago
parent
commit
7b5af7124a
  1. 7
      web/jump/views.py

7
web/jump/views.py

@ -1,11 +1,13 @@
import re import re
from django.shortcuts import redirect from django.shortcuts import redirect
from django.shortcuts import render_to_response
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.http import HttpResponse from django.http import HttpResponse
from web.postkey.models import i2phost from web.postkey.models import i2phost
from web.lib.validation import validate_hostname from web.lib.validation import validate_hostname
from web import settings
def jumper(request, host): def jumper(request, host):
"""Actually do jumps.""" """Actually do jumps."""
@ -24,7 +26,10 @@ def jumper(request, host):
if m: if m:
params = m.group(1) params = m.group(1)
url += '/' + params url += '/' + params
return redirect(url, permanent=True) return render_to_response('jump.html', {
'title': settings.SITE_NAME,
'url': url,
})
def error(request): def error(request):
return HttpResponse('You are trying to access an invalid hostname.') return HttpResponse('You are trying to access an invalid hostname.')

Loading…
Cancel
Save