mirror of
https://github.com/r4sas/py-i2phosts
synced 2025-02-03 02:14:26 +00:00
web/jump/views.py: render jump.html template when redirecting
Following "Jump service implementation hints" by zzz: http://zzz.i2p/topics/740
This commit is contained in:
parent
cff4a4cd2f
commit
7b5af7124a
@ -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…
x
Reference in New Issue
Block a user