Fixed deletection of missing zlib.so, and generation of sources for exporting GEDCOM

svn: r422
This commit is contained in:
Don Allingham 2001-09-23 14:28:15 +00:00
parent d2189f90df
commit b9bbe6bedc
4 changed files with 2201 additions and 1080 deletions

View File

@ -29,7 +29,6 @@ from GrampsParser import *
import string
import time
import gzip
import os
from gnome.ui import *
import sys
@ -37,6 +36,12 @@ import sys
import intl
_ = intl.gettext
try:
import gzip
gzip_ok = 1
except:
gzip_ok = 0
#-------------------------------------------------------------------------
#
# Try to abstract SAX1 from SAX2
@ -64,6 +69,7 @@ def importData(database, filename, callback):
parser = make_parser()
parser.setContentHandler(GrampsImportParser(database,callback,basefile))
if gzip_ok:
use_gzip = 1
try:
f = gzip.open(filename,"r")
@ -72,6 +78,8 @@ def importData(database, filename, callback):
except IOError,msg:
use_gzip = 0
f.close()
else:
use_gzip = 0
try:
if use_gzip:
@ -123,6 +131,7 @@ def loadData(database, filename, callback=None):
parser = make_parser()
parser.setContentHandler(GrampsParser(database,callback,basefile))
if gzip_ok:
use_gzip = 1
try:
f = gzip.open(filename,"r")
@ -130,6 +139,9 @@ def loadData(database, filename, callback=None):
f.close()
except IOError,msg:
use_gzip = 0
f.close()
else:
use_gzip = 0
try:
if use_gzip:

View File

@ -24,10 +24,15 @@ import const
import string
import Config
import time
import gzip
import shutil
import os
try:
import gzip
gzip_ok = 1
except:
gzip_ok = 0
#-------------------------------------------------------------------------
#
#
@ -324,10 +329,13 @@ def exportData(database, filename, callback):
if os.path.isfile(filename):
shutil.copy(filename, filename + ".bak")
if Config.uncompress:
if Config.uncompress ==0 and gzip_ok == 1:
try:
g = gzip.open(filename,"wb")
except:
g = open(filename,"w")
else:
g = gzip.open(filename,"wb")
g = open(filename,"w")
g.write('<?xml version="1.0" encoding="iso-8859-1"?>\n')
g.write('<!DOCTYPE database SYSTEM "gramps.dtd" []>\n')

View File

@ -202,7 +202,9 @@ def add_persons_sources(person):
continue
source_ref = event.getSourceRef()
if source_ref != None:
source_list.append(source_ref)
sbase = source_ref.getBase()
if sbase != None and sbase not in source_list:
source_list.append(sbase)
#-------------------------------------------------------------------------
#
@ -215,7 +217,9 @@ def add_familys_sources(family):
continue
source_ref = event.getSourceRef()
if source_ref != None:
source_list.append(source_ref)
sbase = source_ref.getBase()
if sbase != None and sbase not in source_list:
source_list.append(sbase)
#-------------------------------------------------------------------------
#
@ -539,6 +543,7 @@ def exportData(database, filename):
g.write("1 CHIL @I%s@\n" % person.getId())
for source in source_list:
print source
g.write("0 @S%s@ SOUR\n" % source.getId())
if source.getTitle() != "":
g.write("1 TITL %s\n" % cnvtxt(source.getTitle()))

File diff suppressed because it is too large Load Diff