[lgoweb] redirect to / on invalid key

This commit is contained in:
Frédéric Péters 2011-04-06 17:13:26 +05:30
parent 92f0ed1451
commit c993159cc4
1 changed files with 4 additions and 1 deletions

View File

@ -50,7 +50,10 @@ def lookup(request):
return HttpResponse(response, mimetype="text/plain")
def redirect(request):
symbol = request.REQUEST['q']
try:
symbol = request.REQUEST['q']
except KeyError:
return HttpResponseRedirect('/')
sqlcon = get_sqlconn()
cur = sqlcon.cursor()
cur.execute('select path from symbols where symbol = ? limit 1', (symbol,))