From c581e0f05a6f63f88fdaf9e464371650ada894ac Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Sun, 3 Nov 2013 12:39:51 +0100 Subject: [PATCH] cache email hash on comment creation --- isso/views/comment.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/isso/views/comment.py b/isso/views/comment.py index ff68036..03f1cc7 100644 --- a/isso/views/comment.py +++ b/isso/views/comment.py @@ -108,7 +108,9 @@ def new(app, environ, request, uri): checksum = hashlib.md5(rv["text"].encode('utf-8')).hexdigest() rv["text"] = app.markdown(rv["text"]) - rv["hash"] = str(pbkdf2(rv.get('email') or rv['remote_addr'], app.salt, 1000, 6)) + rv["hash"] = str(pbkdf2(rv['email'] or rv['remote_addr'], app.salt, 1000, 6)) + + app.cache.set('hash', rv['email'] or rv['remote_addr'], rv['hash']) for key in set(rv.keys()) - FIELDS: rv.pop(key)