[library-web] web: don't pass unicode to urllib.quote



commit b2a9479812e8647bab52f688711e13f72b62bca5
Author: Frédéric Péters <fpeters 0d be>
Date:   Tue Feb 2 15:06:46 2016 +0100

    web: don't pass unicode to urllib.quote

 web/api.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/web/api.py b/web/api.py
index 36f53f9..5be552e 100644
--- a/web/api.py
+++ b/web/api.py
@@ -54,6 +54,8 @@ def redirect(request):
         symbol = request.REQUEST['q']
     except KeyError:
         return HttpResponseRedirect('/')
+    if isinstance(symbol, unicode):
+        symbol = symbol.encode('utf-8')
     sqlcon = get_sqlconn()
     cur = sqlcon.cursor()
     cur.execute('select path from symbols where symbol = ? limit 1', (symbol,))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]