|
|
@ -23,7 +23,7 @@ class Comments:
|
|
|
|
'mode', # status of the comment 1 = valid, 2 = pending,
|
|
|
|
'mode', # status of the comment 1 = valid, 2 = pending,
|
|
|
|
# 4 = soft-deleted (cannot hard delete because of replies)
|
|
|
|
# 4 = soft-deleted (cannot hard delete because of replies)
|
|
|
|
'remote_addr', 'text', 'author', 'email', 'website',
|
|
|
|
'remote_addr', 'text', 'author', 'email', 'website',
|
|
|
|
'likes', 'dislikes', 'voters']
|
|
|
|
'likes', 'dislikes', 'voters', 'notification']
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, db):
|
|
|
|
def __init__(self, db):
|
|
|
|
|
|
|
|
|
|
|
@ -33,7 +33,8 @@ class Comments:
|
|
|
|
' tid REFERENCES threads(id), id INTEGER PRIMARY KEY, parent INTEGER,',
|
|
|
|
' tid REFERENCES threads(id), id INTEGER PRIMARY KEY, parent INTEGER,',
|
|
|
|
' created FLOAT NOT NULL, modified FLOAT, mode INTEGER, remote_addr VARCHAR,',
|
|
|
|
' created FLOAT NOT NULL, modified FLOAT, mode INTEGER, remote_addr VARCHAR,',
|
|
|
|
' text VARCHAR, author VARCHAR, email VARCHAR, website VARCHAR,',
|
|
|
|
' text VARCHAR, author VARCHAR, email VARCHAR, website VARCHAR,',
|
|
|
|
' likes INTEGER DEFAULT 0, dislikes INTEGER DEFAULT 0, voters BLOB NOT NULL);'])
|
|
|
|
' likes INTEGER DEFAULT 0, dislikes INTEGER DEFAULT 0, voters BLOB NOT NULL,',
|
|
|
|
|
|
|
|
' notification INTEGER NOT NULL DEFAULT 0);'])
|
|
|
|
|
|
|
|
|
|
|
|
def add(self, uri, c):
|
|
|
|
def add(self, uri, c):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -50,16 +51,16 @@ class Comments:
|
|
|
|
'INSERT INTO comments (',
|
|
|
|
'INSERT INTO comments (',
|
|
|
|
' tid, parent,'
|
|
|
|
' tid, parent,'
|
|
|
|
' created, modified, mode, remote_addr,',
|
|
|
|
' created, modified, mode, remote_addr,',
|
|
|
|
' text, author, email, website, voters )',
|
|
|
|
' text, author, email, website, voters, notification)',
|
|
|
|
'SELECT',
|
|
|
|
'SELECT',
|
|
|
|
' threads.id, ?,',
|
|
|
|
' threads.id, ?,',
|
|
|
|
' ?, ?, ?, ?,',
|
|
|
|
' ?, ?, ?, ?,',
|
|
|
|
' ?, ?, ?, ?, ?',
|
|
|
|
' ?, ?, ?, ?, ?, ?',
|
|
|
|
'FROM threads WHERE threads.uri = ?;'], (
|
|
|
|
'FROM threads WHERE threads.uri = ?;'], (
|
|
|
|
c.get('parent'),
|
|
|
|
c.get('parent'),
|
|
|
|
c.get('created') or time.time(), None, c["mode"], c['remote_addr'],
|
|
|
|
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'), buffer(
|
|
|
|
Bloomfilter(iterable=[c['remote_addr']]).array),
|
|
|
|
Bloomfilter(iterable=[c['remote_addr']]).array), c.get('notification'),
|
|
|
|
uri)
|
|
|
|
uri)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|