REMOTE_ADDR is not unicode

This commit is contained in:
Martin Zimmermann 2013-09-08 14:13:17 +02:00
parent af11656022
commit 449c838be3

View File

@ -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)