6265: can not make back up

svn: r20924
This commit is contained in:
Benny Malengier 2013-01-01 11:16:03 +00:00
parent 0523ef0197
commit 268b3e467b
2 changed files with 8 additions and 5 deletions

View File

@ -39,7 +39,7 @@ import tarfile
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
from cStringIO import StringIO from cStringIO import StringIO
else: else:
from io import StringIO import io
from gramps.gen.ggettext import gettext as _ from gramps.gen.ggettext import gettext as _
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -63,7 +63,7 @@ from gi.repository import Gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from gramps.gui.plug.export import WriterOptionBox from gramps.gui.plug.export import WriterOptionBox
from exportxml import XmlWriter from .exportxml import XmlWriter
from gramps.gen.utils.file import media_path_full, get_unicode_path_from_file_chooser from gramps.gen.utils.file import media_path_full, get_unicode_path_from_file_chooser
from gramps.gen.constfunc import win from gramps.gen.constfunc import win
@ -214,7 +214,10 @@ class PackageWriter(object):
# select_clicked() # select_clicked()
# Write XML now # Write XML now
g = StringIO() if sys.version_info[0] < 3:
g = StringIO()
else:
g = io.BytesIO()
gfile = XmlWriter(self.db, self.user, 2) gfile = XmlWriter(self.db, self.user, 2)
gfile.write_handle(g) gfile.write_handle(g)
tarinfo = tarfile.TarInfo('data.gramps') tarinfo = tarfile.TarInfo('data.gramps')

View File

@ -121,7 +121,7 @@ class GrampsXmlWriter(UpdateCallback):
self.status = None self.status = None
def write(self,filename): def write(self, filename):
""" """
Write the database to the specified file. Write the database to the specified file.
""" """
@ -180,7 +180,7 @@ class GrampsXmlWriter(UpdateCallback):
if self.compress and _gzip_ok: if self.compress and _gzip_ok:
try: try:
g = gzip.GzipFile(mode="wb",fileobj=handle) g = gzip.GzipFile(mode="wb", fileobj=handle)
except: except:
g = handle g = handle
else: else: