From ffc05da5717e016672b87e929c465d8e85af9d41 Mon Sep 17 00:00:00 2001 From: cclauss Date: Thu, 25 Jan 2018 09:34:07 +0100 Subject: [PATCH] Switch from buffer to memoryview in db/comments.py --- isso/db/comments.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/isso/db/comments.py b/isso/db/comments.py index a66c248..c5030bc 100644 --- a/isso/db/comments.py +++ b/isso/db/comments.py @@ -3,8 +3,7 @@ import time from isso.utils import Bloomfilter -from isso.compat import buffer - +from isso.compat import memoryview # required for Python 2.6 class Comments: """Hopefully DB-independend SQL to store, modify and retrieve all @@ -58,7 +57,7 @@ class Comments: 'FROM threads WHERE threads.uri = ?;'], ( c.get('parent'), c.get('created') or time.time(), None, c["mode"], c['remote_addr'], - c['text'], c.get('author'), c.get('email'), c.get('website'), buffer( + c['text'], c.get('author'), c.get('email'), c.get('website'), memoryview( Bloomfilter(iterable=[c['remote_addr']]).array), uri) ) @@ -256,7 +255,7 @@ class Comments: 'UPDATE comments SET', ' likes = likes + 1,' if upvote else 'dislikes = dislikes + 1,', ' voters = ?' - 'WHERE id=?;'], (buffer(bf.array), id)) + 'WHERE id=?;'], (memoryview(bf.array), id)) if upvote: return {'likes': likes + 1, 'dislikes': dislikes}