source page, check for bad file name if archive is used.

svn: r5104
This commit is contained in:
Don Allingham 2005-08-18 03:19:33 +00:00
parent 62d32ed08a
commit b35767c630
2 changed files with 22 additions and 26 deletions

View File

@ -1,6 +1,6 @@
2005-08-17 Don Allingham <don@gramps-project.org> 2005-08-17 Don Allingham <don@gramps-project.org>
* src/plugins/NavWebPage.py: fix source reference links on the * src/plugins/NavWebPage.py: fix source reference links on the
source page. source page, check for bad file name if archive is used.
* src/FamilyView.py: commit person when removed from family * src/FamilyView.py: commit person when removed from family
2005-08-18 Eero Tamminen <eerot@sf> 2005-08-18 Eero Tamminen <eerot@sf>

View File

@ -60,9 +60,9 @@ import Report
import Errors import Errors
import Utils import Utils
import ReportOptions import ReportOptions
import BaseDoc
import ReportUtils import ReportUtils
import ImgManip import ImgManip
import TarFile
from QuestionDialog import ErrorDialog, WarningDialog from QuestionDialog import ErrorDialog, WarningDialog
from NameDisplay import displayer as _nd from NameDisplay import displayer as _nd
from DateHandler import displayer as _dd from DateHandler import displayer as _dd
@ -378,10 +378,8 @@ class BasePage:
of.write('cellspacing="0" border="0">\n') of.write('cellspacing="0" border="0">\n')
for attr in attrlist: for attr in attrlist:
type = attr.get_type() of.write('<tr><td class="field">%s</td>' % _(attr.get_type()))
value = attr.get_value() of.write('<td class="data">%s</td></tr>\n' % attr.get_value())
of.write('<tr><td class="field">%s</td>' % _(type))
of.write('<td class="data">%s</td></tr>\n' % value)
of.write('</table>\n') of.write('</table>\n')
def display_references(self,of,db,handlelist): def display_references(self,of,db,handlelist):
@ -619,7 +617,6 @@ class PlaceListPage(BasePage):
self.sort = Sort.Sort(db) self.sort = Sort.Sort(db)
handle_list = place_handles.keys() handle_list = place_handles.keys()
handle_list.sort(self.sort.by_place_title) handle_list.sort(self.sort.by_place_title)
last_name = ""
last_letter = '' last_letter = ''
for handle in handle_list: for handle in handle_list:
@ -1541,11 +1538,9 @@ class IndividualPage(BasePage):
of.write(self.format_event(event)) of.write(self.format_event(event))
of.write('</td>\n</tr>\n') of.write('</td>\n</tr>\n')
for attr in family.get_attribute_list(): for attr in family.get_attribute_list():
type = attr.get_type()
value = attr.get_value()
of.write('<tr><td>&nbsp;</td>\n') of.write('<tr><td>&nbsp;</td>\n')
of.write('<td class="field">%s</td>' % _(type)) of.write('<td class="field">%s</td>' % _(attr.get_type()))
of.write('<td class="data">%s</td>\n</tr>\n' % value) of.write('<td class="data">%s</td>\n</tr>\n' % attr.get_value())
nobj = family.get_note_object() nobj = family.get_note_object()
if nobj: if nobj:
of.write('<tr><td>&nbsp;</td>\n') of.write('<tr><td>&nbsp;</td>\n')
@ -1741,6 +1736,18 @@ class WebReport(Report.Report):
ErrorDialog(_("Could not create the directory: %s") % \ ErrorDialog(_("Could not create the directory: %s") % \
image_dir_name) image_dir_name)
return return
archive = None
else:
if os.path.isdir(self.target_path):
ErrorDialog(_('Invalid file name'),
_('The archive file must be a file, not a directory'))
return
try:
archive = TarFile.TarFile(self.target_path)
except (OSError,IOError),value:
ErrorDialog(_("Could not create %s") % self.target_path,
value)
return
progress = Utils.ProgressMeter(_("Generate HTML reports"),'') progress = Utils.ProgressMeter(_("Generate HTML reports"),'')
@ -1770,12 +1777,6 @@ class WebReport(Report.Report):
new_list.append(key) new_list.append(key)
ind_list = new_list ind_list = new_list
if self.use_archive:
import TarFile
archive = TarFile.TarFile(self.target_path)
else:
archive = None
if self.css != '': if self.css != '':
self.write_css(archive,self.target_path,self.css) self.write_css(archive,self.target_path,self.css)
@ -1814,7 +1815,7 @@ class WebReport(Report.Report):
if not self.exclude_private: if not self.exclude_private:
person = ReportUtils.sanitize_person(self.database,person) person = ReportUtils.sanitize_person(self.database,person)
idoc = IndividualPage(self.database, person, self.title, IndividualPage(self.database, person, self.title,
ind_list, place_list, source_list, ind_list, place_list, source_list,
self.options, archive, photo_list, levels) self.options, archive, photo_list, levels)
@ -1962,7 +1963,7 @@ class WebReportOptions(ReportOptions.ReportOptions):
gramps_id = person.get_gramps_id() gramps_id = person.get_gramps_id()
else: else:
name = 'PERSON' name = 'PERSON'
gramps_is = '' gramps_id = ''
all = GenericFilter.GenericFilter() all = GenericFilter.GenericFilter()
all.set_name(_("Entire Database")) all.set_name(_("Entire Database"))
@ -1990,11 +1991,8 @@ class WebReportOptions(ReportOptions.ReportOptions):
priv_msg = _("Do not include records marked private") priv_msg = _("Do not include records marked private")
restrict_msg = _("Restrict information on living people") restrict_msg = _("Restrict information on living people")
restrict_years = _("Years to restrict from person's death") restrict_years = _("Years to restrict from person's death")
imgdir_msg = _("Image subdirectory")
title_msg = _("Web site title") title_msg = _("Web site title")
ext_msg = _("File extension") ext_msg = _("File extension")
sep_alpha_msg = _("Split alphabetical sections to separate pages")
tree_msg = _("Include short ancestor tree")
contact_msg = _("Publisher contact/Note ID") contact_msg = _("Publisher contact/Note ID")
download_msg = _("Include download page") download_msg = _("Include download page")
@ -2280,8 +2278,6 @@ class WebReportDialog(Report.ReportDialog):
ErrorDialog(m1,m2) ErrorDialog(m1,m2)
def sort_people(db,handle_list): def sort_people(db,handle_list):
import sets
flist = sets.Set(handle_list) flist = sets.Set(handle_list)
sname_sub = {} sname_sub = {}