Fixed gedcom and gramps exporting

svn: r771
This commit is contained in:
Don Allingham 2002-02-13 01:01:28 +00:00
parent bfb8e54efa
commit 28a3789763
3 changed files with 24 additions and 3 deletions

View File

@ -133,6 +133,25 @@ class XmlWriter:
self.write_xml_data()
self.g.close()
def write_handle(self,handle):
"""
Write the database to the specfied file handle.
"""
use_g = 0
if self.compress:
try:
self.g = gzip.GzipFile(mode="wb",fileobj=handle)
use_g = 1
except:
self.g = handle
else:
self.g = handle
self.write_xml_data()
if use_g:
self.g.close()
def write_xml_data(self):
date = string.split(time.ctime(time.time()))

View File

@ -216,7 +216,7 @@ def add_persons_sources(person,slist,private):
if sbase != None and sbase not in slist:
slist.append(sbase)
for event in person.getAttibuteList():
for event in person.getAttributeList():
if private and event.getPrivacy():
continue
for source_ref in event.getSourceRefList():
@ -224,7 +224,7 @@ def add_persons_sources(person,slist,private):
if sbase != None and sbase not in slist:
slist.append(sbase)
for name in person.getNameList() + [person.getPrimaryName()]:
for name in person.getAlternateNames() + [person.getPrimaryName()]:
if private and name.getPrivacy():
continue
for source_ref in name.getSourceRefList():

View File

@ -75,7 +75,9 @@ def exportData(database, filename):
t = TarFile.TarFile(filename)
g = StringIO()
WriteXML.write_xml_data(database,g,callback,1)
gfile = WriteXML.XmlWriter(database,None,1)
gfile.write_handle(g)
mtime = time.time()
t.add_file("data.gramps",mtime,g)
g.close()