]> Nutra Git (v2) - gamesguru/getmyancestors.git/commitdiff
supports empty notes
authorlinek <benoitfontaine.ba@gmail.com>
Fri, 3 Nov 2017 20:28:46 +0000 (21:28 +0100)
committerlinek <benoitfontaine.ba@gmail.com>
Fri, 3 Nov 2017 20:28:46 +0000 (21:28 +0100)
getmyancestors.py

index ddc95d6869c3112cc1ff4955e7725371215f2367..3783fdecf04a51a140f314eaf93ea29d2a3a489f 100755 (executable)
@@ -505,7 +505,9 @@ class Indi:
         notes = self.tree.fs.get_url('https://familysearch.org/platform/tree/persons/' + self.fid + '/notes.json')
         if notes:
             for n in notes['persons'][0]['notes']:
-                self.notes.add(Note('===' + n['subject'] + '===\n' + n['text'] + '\n', self.tree))
+                text_note = '===' + n['subject'] + '===\n' if 'subject' in n else ''
+                text_note += n['text'] + '\n' if 'text' in n else ''
+                self.notes.add(Note(text_note, self.tree))
 
     # retrieve LDS ordinances
     def get_ordinances(self):
@@ -666,7 +668,9 @@ class Fam:
             notes = self.tree.fs.get_url('https://familysearch.org/platform/tree/couple-relationships/' + self.fid + '/notes.json')
             if notes:
                 for n in notes['relationships'][0]['notes']:
-                    self.notes.add(Note('===' + n['subject'] + '===\n' + n['text'] + '\n', self.tree))
+                    text_note = '===' + n['subject'] + '===\n' if 'subject' in n else ''
+                    text_note += n['text'] + '\n' if 'text' in n else ''
+                    self.notes.add(Note(text_note, self.tree))
 
     # retrieve contributors
     def get_contributors(self):