* src/plugins/NavWebPage.py: Avoid some segfaults

svn: r4936
This commit is contained in:
Martin Hawlisch 2005-07-15 05:32:31 +00:00
parent 0116f4040d
commit c31363c02b
2 changed files with 51 additions and 36 deletions

View File

@ -1,3 +1,6 @@
2005-07-15 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/NavWebPage.py: Avoid some segfaults
2005-07-14 Don Allingham <don@gramps-project.org> 2005-07-14 Don Allingham <don@gramps-project.org>
* src/plugins/NavWebPage.py: gallery/media object enhancements, div/span fixes * src/plugins/NavWebPage.py: gallery/media object enhancements, div/span fixes
in HTML, source and place references, individual source pges. in HTML, source and place references, individual source pges.

View File

@ -205,6 +205,7 @@ class BasePage:
photo_handle = photolist[0].get_reference_handle() photo_handle = photolist[0].get_reference_handle()
photo = db.get_object_from_handle(photo_handle) photo = db.get_object_from_handle(photo_handle)
if photo.get_mime_type():
try: try:
newpath = self.copy_media(photo) newpath = self.copy_media(photo)
of.write('<div class="snapshot">\n') of.write('<div class="snapshot">\n')
@ -806,8 +807,9 @@ class ContactPage(BasePage):
of.write('<h3>%s</h3>\n' % _('Contact')) of.write('<h3>%s</h3>\n' % _('Contact'))
note_id = options.handler.options_dict['NWEBcontact'] note_id = options.handler.options_dict['NWEBcontact']
if note_id:
obj = db.get_object_from_handle(note_id) obj = db.get_object_from_handle(note_id)
if obj:
mime_type = obj.get_mime_type() mime_type = obj.get_mime_type()
if mime_type and mime_type.startswith("image"): if mime_type and mime_type.startswith("image"):
@ -833,6 +835,7 @@ class ContactPage(BasePage):
of.write('%s<br>\n' % r.email) of.write('%s<br>\n' % r.email)
of.write('</blockquote>\n') of.write('</blockquote>\n')
if obj:
nobj = obj.get_note_object() nobj = obj.get_note_object()
if nobj: if nobj:
format = nobj.get_format() format = nobj.get_format()
@ -845,6 +848,8 @@ class ContactPage(BasePage):
of.write('<p>%s</p>\n' % text) of.write('<p>%s</p>\n' % text)
else: else:
of.write('<br><br><br><br>\n') of.write('<br><br><br><br>\n')
else:
of.write('<br><br><br><br>\n')
self.display_footer(of) self.display_footer(of)
self.close_file(of) self.close_file(of)
@ -897,7 +902,13 @@ class IndividualPage(BasePage):
index = 1 index = 1
for sref in sreflist: 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()) source = self.db.get_source_from_handle(sref.get_base_handle())
author = source.get_author() author = source.get_author()
@ -905,6 +916,7 @@ class IndividualPage(BasePage):
publisher = source.get_publication_info() publisher = source.get_publication_info()
date = _dd.display(sref.get_date_object()) date = _dd.display(sref.get_date_object())
of.write('<tr><td class="field">%d. ' % index) of.write('<tr><td class="field">%d. ' % index)
of.write('<a href="%s.%s">' % (source.handle,self.ext))
values = [] values = []
if author: if author:
values.append(author) values.append(author)
@ -915,7 +927,7 @@ class IndividualPage(BasePage):
if date: if date:
values.append(date) values.append(date)
of.write(', '.join(values)) of.write(', '.join(values))
of.write('</td></tr>\n') of.write('</a></td></tr>\n')
of.write('</table>\n') of.write('</table>\n')
def display_ind_pedigree(self,of): def display_ind_pedigree(self,of):