From 850b2b4bfb68ee43d0ffc52af4a9497799517833 Mon Sep 17 00:00:00 2001 From: Martin Zimmermann Date: Mon, 11 Nov 2013 11:44:32 +0100 Subject: [PATCH] set mode to 4 (deleted) when isDeleted is true --- isso/migrate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/isso/migrate.py b/isso/migrate.py index 8bbfa2a..a12ac61 100644 --- a/isso/migrate.py +++ b/isso/migrate.py @@ -3,7 +3,6 @@ # TODO # # - export does not include website from commenters -# - Disqus includes already deleted comments from __future__ import division @@ -61,7 +60,7 @@ def disqus(db, xmlfile): 'created': mktime(strptime( post.find('%screatedAt' % ns).text, '%Y-%m-%dT%H:%M:%SZ')), '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: @@ -89,6 +88,9 @@ def disqus(db, xmlfile): threads.add(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[100%%] %i threads, %i comments\n" % (len(threads), len(comments)))