2008-01-16 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDbUtils/_GrampsDbWriteXML.py: import gzip only once svn: r9838
This commit is contained in:
parent
0ba34220a1
commit
00c4692b28
@ -1,3 +1,6 @@
|
|||||||
|
2008-01-16 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
|
* src/GrampsDbUtils/_GrampsDbWriteXML.py: import gzip only once
|
||||||
|
|
||||||
2008-01-16 Peter Landgren <peter.talken@telia.com>
|
2008-01-16 Peter Landgren <peter.talken@telia.com>
|
||||||
* man/Makefile.am: Swedish added (sv).
|
* man/Makefile.am: Swedish added (sv).
|
||||||
* man/sv/gramps.1.in: Added Swedish man page (sv).
|
* man/sv/gramps.1.in: Added Swedish man page (sv).
|
||||||
|
@ -54,13 +54,19 @@ log = logging.getLogger(".WriteXML")
|
|||||||
|
|
||||||
import gen.lib
|
import gen.lib
|
||||||
from BasicUtils import UpdateCallback
|
from BasicUtils import UpdateCallback
|
||||||
|
|
||||||
#from gen.db.dbconst import \
|
|
||||||
# PERSON_KEY,FAMILY_KEY,SOURCE_KEY,EVENT_KEY,\
|
|
||||||
# MEDIA_KEY,PLACE_KEY,REPOSITORY_KEY,NOTE_KEY
|
|
||||||
#
|
|
||||||
from gen.db.exceptions import GrampsDbWriteFailure
|
from gen.db.exceptions import GrampsDbWriteFailure
|
||||||
#from gen.utils.longop import LongOpStatus
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Attempt to load the GZIP library. Some version of python do not seem
|
||||||
|
# to be compiled with this available.
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
try:
|
||||||
|
import gzip
|
||||||
|
_gzip_ok = 1
|
||||||
|
except:
|
||||||
|
_gzip_ok = 0
|
||||||
|
|
||||||
_xml_version = "1.2.0"
|
_xml_version = "1.2.0"
|
||||||
|
|
||||||
@ -103,10 +109,7 @@ class GrampsDbXmlWriter(UpdateCallback):
|
|||||||
"""
|
"""
|
||||||
UpdateCallback.__init__(self, callback)
|
UpdateCallback.__init__(self, callback)
|
||||||
self.compress = compress
|
self.compress = compress
|
||||||
if self.compress:
|
if not _gzip_ok:
|
||||||
try:
|
|
||||||
import gzip
|
|
||||||
except:
|
|
||||||
self.compress = False
|
self.compress = False
|
||||||
self.db = db
|
self.db = db
|
||||||
self.strip_photos = strip_photos
|
self.strip_photos = strip_photos
|
||||||
@ -141,8 +144,7 @@ class GrampsDbXmlWriter(UpdateCallback):
|
|||||||
|
|
||||||
self.fileroot = os.path.dirname(filename)
|
self.fileroot = os.path.dirname(filename)
|
||||||
try:
|
try:
|
||||||
if self.compress:
|
if self.compress and _gzip_ok:
|
||||||
import gzip
|
|
||||||
try:
|
try:
|
||||||
g = gzip.open(filename,"wb")
|
g = gzip.open(filename,"wb")
|
||||||
except:
|
except:
|
||||||
@ -166,8 +168,7 @@ class GrampsDbXmlWriter(UpdateCallback):
|
|||||||
Write the database to the specified file handle.
|
Write the database to the specified file handle.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if self.compress:
|
if self.compress and _gzip_ok:
|
||||||
import gzip
|
|
||||||
try:
|
try:
|
||||||
g = gzip.GzipFile(mode="wb",fileobj=handle)
|
g = gzip.GzipFile(mode="wb",fileobj=handle)
|
||||||
except:
|
except:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user