From 449c838be3af15887cd14c35c2ea1e4f827fc04e Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Sun, 8 Sep 2013 14:13:17 +0200 Subject: [PATCH] REMOTE_ADDR is not unicode --- isso/views/comment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/isso/views/comment.py b/isso/views/comment.py index 298f396..ca4a5ae 100644 --- a/isso/views/comment.py +++ b/isso/views/comment.py @@ -59,7 +59,7 @@ def create(app, environ, request, uri): if "email" in data: hash = data["email"] else: - hash = utils.salt(utils.anonymize(request.remote_addr)) + hash = utils.salt(utils.anonymize(unicode(request.remote_addr))) comment = models.Comment( text=data["text"], parent=data.get("parent"), @@ -70,7 +70,7 @@ def create(app, environ, request, uri): hash=hashlib.md5(hash).hexdigest()) try: - rv = app.db.add(uri, comment, utils.anonymize(request.remote_addr)) + rv = app.db.add(uri, comment, utils.anonymize(unicode(request.remote_addr))) except sqlite3.Error: logging.exception('uncaught SQLite3 exception') abort(400)