From 3b87242d0ae02b588bd9fcba2e8cdffcbf0ad552 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Beno=C3=AEt=20Fontaine?= Date: Sat, 10 Nov 2018 20:03:56 +0100 Subject: [PATCH] Fix an error when changes.json doesn't return datas (status code 204) --- getmyancestors.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/getmyancestors.py b/getmyancestors.py index 5ff62a7..244ac79 100755 --- a/getmyancestors.py +++ b/getmyancestors.py @@ -558,9 +558,10 @@ class Indi: def get_contributors(self): temp = set() data = self.tree.fs.get_url('/platform/tree/persons/%s/changes.json' % self.fid) - for entries in data['entries']: - for contributors in entries['contributors']: - temp.add(contributors['name']) + if data: + for entries in data['entries']: + for contributors in entries['contributors']: + temp.add(contributors['name']) if temp: text = '=== ' + self.tree.fs._('Contributors') + ' ===\n' + '\n'.join(sorted(temp)) for n in self.tree.notes: @@ -678,9 +679,10 @@ class Fam: if self.fid: temp = set() data = self.tree.fs.get_url('/platform/tree/couple-relationships/%s/changes.json' % self.fid) - for entries in data['entries']: - for contributors in entries['contributors']: - temp.add(contributors['name']) + if data: + for entries in data['entries']: + for contributors in entries['contributors']: + temp.add(contributors['name']) if temp: text = '=== ' + self.tree.fs._('Contributors') + ' ===\n' + '\n'.join(sorted(temp)) for n in self.tree.notes: -- 2.52.0