diff --git a/isso/migrate.py b/isso/migrate.py index 2a985f1..a2089ff 100644 --- a/isso/migrate.py +++ b/isso/migrate.py @@ -102,7 +102,7 @@ class Disqus(object): 'email': post.find('{0}author/{0}email'.format(Disqus.ns)).text, 'created': mktime(strptime( post.find(Disqus.ns + 'createdAt').text, '%Y-%m-%dT%H:%M:%SZ')), - 'remote_addr': '127.0.0.0', + 'remote_addr': anonymize(post.find(Disqus.ns + 'ipAddress').text), 'mode': 1 if post.find(Disqus.ns + "isDeleted").text == "false" else 4 } diff --git a/isso/tests/test_migration.py b/isso/tests/test_migration.py index 29adbd5..9634ae3 100644 --- a/isso/tests/test_migration.py +++ b/isso/tests/test_migration.py @@ -33,6 +33,7 @@ class TestMigration(unittest.TestCase): self.assertEqual(a["author"], "peter") self.assertEqual(a["email"], "foo@bar.com") + self.assertEqual(a["remote_addr"], "127.0.0.0") b = db.comments.get(2) self.assertEqual(b["parent"], a["id"]) @@ -53,6 +54,7 @@ class TestMigration(unittest.TestCase): first = db.comments.get(1) self.assertEqual(first["author"], "Ohai") self.assertEqual(first["text"], "Erster!1") + self.assertEqual(first["remote_addr"], "82.119.20.0") second = db.comments.get(2) self.assertEqual(second["author"], "Tester")