Revert db/comments.py too

pull/378/head
cclauss 6 years ago committed by GitHub
parent 40f4ddb483
commit ca75f6ae10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@
import time
from isso.utils import Bloomfilter
# from isso.compat import memoryview # required for Python 2.6
from isso.compat import buffer
class Comments:
"""Hopefully DB-independend SQL to store, modify and retrieve all
@ -57,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'), memoryview(
c['text'], c.get('author'), c.get('email'), c.get('website'), buffer(
Bloomfilter(iterable=[c['remote_addr']]).array),
uri)
)
@ -255,7 +255,7 @@ class Comments:
'UPDATE comments SET',
' likes = likes + 1,' if upvote else 'dislikes = dislikes + 1,',
' voters = ?'
'WHERE id=?;'], (memoryview(bf.array), id))
'WHERE id=?;'], (buffer(bf.array), id))
if upvote:
return {'likes': likes + 1, 'dislikes': dislikes}

Loading…
Cancel
Save