set parent to null if parent is not top-level comment
This commit is contained in:
parent
24adafa25b
commit
ce14726f2f
@ -37,6 +37,12 @@ class Comments:
|
|||||||
Add new comment to DB and return a mapping of :attribute:`fields` and
|
Add new comment to DB and return a mapping of :attribute:`fields` and
|
||||||
database values.
|
database values.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if "parent" in c:
|
||||||
|
rv = self.db.execute("SELECT parent FROM comments WHERE id=?", (c.get('parent'), )).fetchone()
|
||||||
|
if rv and rv[0] is not None:
|
||||||
|
c["parent"] = None
|
||||||
|
|
||||||
self.db.execute([
|
self.db.execute([
|
||||||
'INSERT INTO comments (',
|
'INSERT INTO comments (',
|
||||||
' tid, parent,'
|
' tid, parent,'
|
||||||
|
Loading…
Reference in New Issue
Block a user