diff --git a/ChangeLog b/ChangeLog index b95723eb4..14b24323b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-21 Alex Roitman + * src/PluginUtils/_ReportUtils.py (buried_str): Typo. + * src/plugins/DetDescendantReport.py (write_children): Use child_refs. + * src/plugins/DetAncestralReport.py (write_children): Use child_refs. + * src/plugins/IndivComplete.py (write_fact): Use new event type. + * src/docgen/KwordDoc.py (KwordDoc.close): Use tarile. + 2006-04-21 Don Allingham * src/StartupDialog.py: fix close * src/plugins/Desbrowser.py: Use ActivPersonTool diff --git a/src/PluginUtils/_ReportUtils.py b/src/PluginUtils/_ReportUtils.py index eda9f59f1..8f488263d 100644 --- a/src/PluginUtils/_ReportUtils.py +++ b/src/PluginUtils/_ReportUtils.py @@ -1989,7 +1989,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""): burial = None for event_ref in person.get_event_ref_list(): event = database.get_event_from_handle(event_ref.ref) - if event and int(event.get_type()) == RelLib.Event.BURIAL: + if event and int(event.get_type()) == RelLib.EventType.BURIAL: burial = event break diff --git a/src/docgen/KwordDoc.py b/src/docgen/KwordDoc.py index 563f7181b..f5b789d31 100644 --- a/src/docgen/KwordDoc.py +++ b/src/docgen/KwordDoc.py @@ -27,8 +27,8 @@ #------------------------------------------------------------------------ import time import cStringIO -import gzip import os +import tarfile from gettext import gettext as _ #------------------------------------------------------------------------ @@ -38,7 +38,6 @@ from gettext import gettext as _ #------------------------------------------------------------------------ import BaseDoc import Errors -from TarFile import TarFile from PluginUtils import register_text_doc import ImgManip import Mime @@ -254,7 +253,7 @@ class KwordDoc(BaseDoc.BaseDoc): self.f.write('\n') try: - tar = TarFile(self.filename) + archive = tarfile.open(self.filename,'w:gz') except IOError, msg: text = _("Could not open %s") % self.filename Errors.ReportError(text + "\n" + str(msg)) @@ -262,15 +261,27 @@ class KwordDoc(BaseDoc.BaseDoc): except: Errors.ReportError(_("Could not open %s") % self.filename) return - - tar.add_file("documentinfo.xml",self.mtime,self.m) - tar.add_file("maindoc.xml",self.mtime,self.f) - for filedata in self.media_list: - f = open(filedata[0],"r") - tar.add_file(filedata[1],self.mtime,f) - f.close() - tar.close() + tarinfo = tarfile.TarInfo('documentinfo.xml') + tarinfo.size = len(self.m.getvalue()) + tarinfo.mtime = self.mtime + tarinfo.uid = os.getuid() + tarinfo.gid = os.getgid() + self.m.seek(0) + archive.addfile(tarinfo,self.m) + + tarinfo = tarfile.TarInfo('maindoc.xml') + tarinfo.size = len(self.f.getvalue()) + tarinfo.mtime = self.mtime + tarinfo.uid = os.getuid() + tarinfo.gid = os.getgid() + self.f.seek(0) + archive.addfile(tarinfo,self.f) + + for filedata in self.media_list: + archive.add(filedata[0]) + + archive.close() self.f.close() self.m.close() diff --git a/src/plugins/DetAncestralReport.py b/src/plugins/DetAncestralReport.py index d96ea4486..3eecae67a 100644 --- a/src/plugins/DetAncestralReport.py +++ b/src/plugins/DetAncestralReport.py @@ -382,7 +382,7 @@ class DetAncestorReport(Report.Report): """ List children. """ - if not family.get_child_handle_list(): + if not family.get_child_ref_list(): return mother_handle = family.get_mother_handle() @@ -405,7 +405,8 @@ class DetAncestorReport(Report.Report): self.doc.end_paragraph() cnt = 1 - for child_handle in family.get_child_handle_list(): + for child_ref in family.get_child_ref_list(): + child_handle = child_ref.ref child = self.database.get_person_from_handle(child_handle) child_name = _nd.display(child) diff --git a/src/plugins/DetDescendantReport.py b/src/plugins/DetDescendantReport.py index a60a1a3aa..b39da9743 100644 --- a/src/plugins/DetDescendantReport.py +++ b/src/plugins/DetDescendantReport.py @@ -150,10 +150,10 @@ class DetDescendantReport(Report.Report): index = 0 for family_handle in person.get_family_handle_list(): family = self.database.get_family_from_handle(family_handle) - for child_handle in family.get_child_handle_list(): - child = self.database.get_family_from_handle(child_handle) + for child_ref in family.get_child_ref_list(): + child = self.database.get_family_from_handle(child_ref.ref) ix = max(self.map.keys()) - self.apply_filter(child_handle, ix+1, + self.apply_filter(child_ref.ref, ix+1, pid+HENRY[index], cur_gen+1) index += 1 @@ -410,7 +410,7 @@ class DetDescendantReport(Report.Report): """ List children. """ - if not family.get_child_handle_list(): + if not family.get_child_ref_list(): return mother_handle = family.get_mother_handle() @@ -433,7 +433,8 @@ class DetDescendantReport(Report.Report): self.doc.end_paragraph() cnt = 1 - for child_handle in family.get_child_handle_list(): + for child_ref in family.get_child_ref_list(): + child_handle = child_ref.ref child = self.database.get_person_from_handle(child_handle) child_name = _nd.display(child) diff --git a/src/plugins/IndivComplete.py b/src/plugins/IndivComplete.py index 955b78eee..f3f4927cd 100644 --- a/src/plugins/IndivComplete.py +++ b/src/plugins/IndivComplete.py @@ -113,8 +113,7 @@ class IndivCompleteReport(Report.Report): def write_fact(self,event): if event == None: return - evtType = event.get_type() - name = Utils.format_event( evtType ) + name = str(event.get_type()) date = DateHandler.get_date(event) place_handle = event.get_place_handle() if place_handle: