set mode to 4 (deleted) when isDeleted is true

This commit is contained in:
Martin Zimmermann 2013-11-11 11:44:32 +01:00
parent 8c0af3b10f
commit 850b2b4bfb

View File

@ -3,7 +3,6 @@
# TODO # TODO
# #
# - export does not include website from commenters # - export does not include website from commenters
# - Disqus includes already deleted comments
from __future__ import division from __future__ import division
@ -61,7 +60,7 @@ def disqus(db, xmlfile):
'created': mktime(strptime( 'created': mktime(strptime(
post.find('%screatedAt' % ns).text, '%Y-%m-%dT%H:%M:%SZ')), post.find('%screatedAt' % ns).text, '%Y-%m-%dT%H:%M:%SZ')),
'remote_addr': '127.0.0.0', 'remote_addr': '127.0.0.0',
'mode': 1 'mode': 1 if post.find("%sisDeleted" % ns).text == "false" else 4
} }
if post.find(ns + 'parent') is not None: if post.find(ns + 'parent') is not None:
@ -89,6 +88,9 @@ def disqus(db, xmlfile):
threads.add(id) threads.add(id)
insert(db, thread, res[id]) insert(db, thread, res[id])
# in case a comment has been deleted (and no further childs)
db.comments._remove_stale()
sys.stdout.write("\r%s" % (" "*cols)) sys.stdout.write("\r%s" % (" "*cols))
sys.stdout.write("\r[100%%] %i threads, %i comments\n" % (len(threads), len(comments))) sys.stdout.write("\r[100%%] %i threads, %i comments\n" % (len(threads), len(comments)))