From 2e6c2f1c1037c9c61f43e023e30bd47a64dc7748 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Thu, 10 Mar 2005 22:19:19 +0000 Subject: [PATCH] * src/plugins/NavWebPage.py: Catch invalid HomeNote object svn: r4158 --- ChangeLog | 1 + src/plugins/NavWebPage.py | 39 +++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0dd6f29d4..d4e452c03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ HaveAltFamilies,HavePhotos,HaveChildren,NeverMarried, MultipleMarriages,NoBirthdate): Add filter rules. * src/gramps_main.py (init_filters): Add new filters to the menu. + * src/plugins/NavWebPage.py: Catch invalid HomeNote object 2005-03-09 Don Allingham * src/ChooseParents.py: Fix widget sensitivity problem, assign diff --git a/src/plugins/NavWebPage.py b/src/plugins/NavWebPage.py index bfd174675..74978b382 100644 --- a/src/plugins/NavWebPage.py +++ b/src/plugins/NavWebPage.py @@ -398,24 +398,27 @@ class HomePage(BasePage): if note_id: obj = db.get_object_from_gramps_id(note_id) - if obj.get_mime_type()[0:5] == "image": - newpath = obj.gramps_id + os.path.splitext(obj.get_path())[1] - shutil.copyfile(obj.get_path(), - os.path.join(html_dir,newpath)) - of.write('
\n') - of.write('' % newpath) - of.write('
\n') - - note_obj = obj.get_note_object() - if note_obj: - text = note_obj.get() - if note_obj.get_format(): - of.write('
\n%s\n
\n' % text) - else: - of.write('

') - of.write('

'.join(text.split('\n'))) - of.write('

') + if not obj: + print "%s object not found" % note_id + else: + if obj.get_mime_type()[0:5] == "image": + newpath = obj.gramps_id + os.path.splitext(obj.get_path())[1] + shutil.copyfile(obj.get_path(), + os.path.join(html_dir,newpath)) + of.write('
\n') + of.write('' % newpath) + of.write('
\n') + + note_obj = obj.get_note_object() + if note_obj: + text = note_obj.get() + if note_obj.get_format(): + of.write('
\n%s\n
\n' % text) + else: + of.write('

') + of.write('

'.join(text.split('\n'))) + of.write('

') self.display_footer(of) of.close()