From 16c142a5c1e0a666bc96d5d02ac98142f669c33c Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Fri, 5 Nov 2010 06:32:25 +0000 Subject: [PATCH] pyi2phosts/postkey/views.py: check for hostname presence in success() --- pyi2phosts/postkey/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyi2phosts/postkey/views.py b/pyi2phosts/postkey/views.py index 995534f..3126064 100644 --- a/pyi2phosts/postkey/views.py +++ b/pyi2phosts/postkey/views.py @@ -59,9 +59,12 @@ def addkey(request): }, context_instance=RequestContext(request)) def success(request): - return render_to_response('success_submission.html', { - 'title': settings.SITE_NAME, - 'hostname': request.session['hostname'], - }) + if 'hostname' in request.session: + return render_to_response('success_submission.html', { + 'title': settings.SITE_NAME, + 'hostname': request.session['hostname'], + }) + else: + return redirect('/') log = get_logger(filename=settings.LOG_FILE, log_level=settings.LOG_LEVEL)