From 1f4ced626ce69414cde73b9dd7ae04c357ab9381 Mon Sep 17 00:00:00 2001 From: fliiiix Date: Sat, 15 Dec 2018 20:01:42 +0100 Subject: [PATCH] Import disqus posts without Email Fix #477 It looks like disqus has stoped to add a Email into there exports. So this sets the email just to ''. This can be changed to a default email if that is prefered. Signed-off-by: fliiiix --- isso/migrate.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/isso/migrate.py b/isso/migrate.py index c32a63c..a1603f1 100644 --- a/isso/migrate.py +++ b/isso/migrate.py @@ -102,12 +102,13 @@ class Disqus(object): res = defaultdict(list) for post in tree.findall(Disqus.ns + 'post'): + email = post.find('{0}author/{0}email'.format(Disqus.ns)) item = { 'dsq:id': post.attrib.get(Disqus.internals + 'id'), 'text': post.find(Disqus.ns + 'message').text, 'author': post.find('{0}author/{0}name'.format(Disqus.ns)).text, - 'email': post.find('{0}author/{0}email'.format(Disqus.ns)).text, + 'email': email.text if email else '', 'created': mktime(strptime( post.find(Disqus.ns + 'createdAt').text, '%Y-%m-%dT%H:%M:%SZ')), 'remote_addr': anonymize(post.find(Disqus.ns + 'ipAddress').text), @@ -150,10 +151,11 @@ class Disqus(object): if post.attrib.get(Disqus.internals + "id") not in orphans: continue + email = post.find("{0}author/{0}email".format(Disqus.ns)) print(" * {0} by {1} <{2}>".format( post.attrib.get(Disqus.internals + "id"), post.find("{0}author/{0}name".format(Disqus.ns)).text, - post.find("{0}author/{0}email".format(Disqus.ns)).text)) + email.text if email else "")) print(textwrap.fill(post.find(Disqus.ns + "message").text, initial_indent=" ", subsequent_indent=" ")) print("")