diff --git a/isso/views/comment.py b/isso/views/comment.py index ecde525..a8d13c6 100644 --- a/isso/views/comment.py +++ b/isso/views/comment.py @@ -166,7 +166,6 @@ def single(app, environ, request, id): for key in set(rv.keys()) - FIELDS: rv.pop(key) - app.cache.delete('hash', id) logger.info('comment %i edited: %s', id, json.dumps(rv)) checksum = hashlib.md5(rv["text"].encode('utf-8')).hexdigest() @@ -178,12 +177,14 @@ def single(app, environ, request, id): if request.method == 'DELETE': + item = app.db.comments.get(id) + app.cache.delete('hash', item['email'] or item['remote_addr']) + rv = app.db.comments.delete(id) if rv: for key in set(rv.keys()) - FIELDS: rv.pop(key) - app.cache.delete('hash', id) logger.info('comment %i deleted', id) resp = Response(json.dumps(rv), 200, content_type='application/json')