diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog
index 4cda6bd97..52f916e57 100644
--- a/gramps2/ChangeLog
+++ b/gramps2/ChangeLog
@@ -1,3 +1,6 @@
+2005-07-15 Martin Hawlisch
+ * src/plugins/NavWebPage.py: Avoid some segfaults
+
2005-07-14 Don Allingham
* src/plugins/NavWebPage.py: gallery/media object enhancements, div/span fixes
in HTML, source and place references, individual source pges.
diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py
index fd82c7874..4eea0b54e 100644
--- a/gramps2/src/plugins/NavWebPage.py
+++ b/gramps2/src/plugins/NavWebPage.py
@@ -205,15 +205,16 @@ class BasePage:
photo_handle = photolist[0].get_reference_handle()
photo = db.get_object_from_handle(photo_handle)
- try:
- newpath = self.copy_media(photo)
- of.write('\n')
- except (IOError,OSError),msg:
- ErrorDialog(str(msg))
+ if photo.get_mime_type():
+ try:
+ newpath = self.copy_media(photo)
+ of.write('\n')
+ except (IOError,OSError),msg:
+ ErrorDialog(str(msg))
def display_note_object(self,of,noteobj=None):
if not noteobj:
@@ -806,22 +807,23 @@ class ContactPage(BasePage):
of.write('%s
\n' % _('Contact'))
note_id = options.handler.options_dict['NWEBcontact']
-
- obj = db.get_object_from_handle(note_id)
- mime_type = obj.get_mime_type()
-
- if mime_type and mime_type.startswith("image"):
- try:
- newpath = self.copy_media(obj)
- of.write('\n')
- of.write('
')
- of.write('')
- of.write('' % (note_id,self.ext))
- of.write(' |
\n')
- of.write('
\n')
- except (IOError,OSError),msg:
- ErrorDialog(str(msg))
+ if note_id:
+ obj = db.get_object_from_handle(note_id)
+ if obj:
+ mime_type = obj.get_mime_type()
+
+ if mime_type and mime_type.startswith("image"):
+ try:
+ newpath = self.copy_media(obj)
+ of.write('\n')
+ of.write('
')
+ of.write('')
+ of.write('' % (note_id,self.ext))
+ of.write(' |
\n')
+ of.write('
\n')
+ except (IOError,OSError),msg:
+ ErrorDialog(str(msg))
r = db.get_researcher()
@@ -833,16 +835,19 @@ class ContactPage(BasePage):
of.write('%s
\n' % r.email)
of.write('\n')
- nobj = obj.get_note_object()
- if nobj:
- format = nobj.get_format()
- text = nobj.get()
-
- if format:
- text = u"" + u"
".join(text.split("\n"))
+ if obj:
+ nobj = obj.get_note_object()
+ if nobj:
+ format = nobj.get_format()
+ text = nobj.get()
+
+ if format:
+ text = u"" + u"
".join(text.split("\n"))
+ else:
+ text = u"
".join(text.split("\n"))
+ of.write('
%s
\n' % text)
else:
- text = u"".join(text.split("\n"))
- of.write('
%s
\n' % text)
+ of.write('
\n')
else:
of.write('
\n')
@@ -897,7 +902,13 @@ class IndividualPage(BasePage):
index = 1
for sref in sreflist:
- self.src_list.add(sref.get_base_handle())
+
+ if self.src_list.has_key(sref.get_base_handle()):
+ if self.person.handle not in self.src_list[sref.get_base_handle()]:
+ self.src_list[sref.get_base_handle()].append(self.person.handle)
+ else:
+ self.src_list[sref.get_base_handle()] = [self.person.handle]
+
source = self.db.get_source_from_handle(sref.get_base_handle())
author = source.get_author()
@@ -905,6 +916,7 @@ class IndividualPage(BasePage):
publisher = source.get_publication_info()
date = _dd.display(sref.get_date_object())
of.write('%d. ' % index)
+ of.write('' % (source.handle,self.ext))
values = []
if author:
values.append(author)
@@ -915,7 +927,7 @@ class IndividualPage(BasePage):
if date:
values.append(date)
of.write(', '.join(values))
- of.write(' |
\n')
+ of.write('\n')
of.write('\n')
def display_ind_pedigree(self,of):