* src/plugins/NavWebPage.py: Catch invalid HomeNote object

svn: r4158
This commit is contained in:
Martin Hawlisch 2005-03-10 22:19:19 +00:00
parent 46da2d9a61
commit 1869866af9
2 changed files with 22 additions and 18 deletions

View File

@ -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 <don@gramps-project.org>
* src/ChooseParents.py: Fix widget sensitivity problem, assign

View File

@ -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('<div align="center">\n')
of.write('<img border="0" ')
of.write('src="%s" />' % newpath)
of.write('</div>\n')
note_obj = obj.get_note_object()
if note_obj:
text = note_obj.get()
if note_obj.get_format():
of.write('<pre>\n%s\n</pre>\n' % text)
else:
of.write('<p>')
of.write('</p><p>'.join(text.split('\n')))
of.write('</p>')
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('<div align="center">\n')
of.write('<img border="0" ')
of.write('src="%s" />' % newpath)
of.write('</div>\n')
note_obj = obj.get_note_object()
if note_obj:
text = note_obj.get()
if note_obj.get_format():
of.write('<pre>\n%s\n</pre>\n' % text)
else:
of.write('<p>')
of.write('</p><p>'.join(text.split('\n')))
of.write('</p>')
self.display_footer(of)
of.close()