* src/plugins/ReadPkg.py (impData): Use persistent directory for
unpacking the tarball: we need images to stay there. svn: r5924
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2006-02-12 Alex Roitman <shura@gramps-project.org>
|
||||||
|
* src/plugins/ReadPkg.py (impData): Use persistent directory for
|
||||||
|
unpacking the tarball: we need images to stay there.
|
||||||
|
|
||||||
2006-02-11 Don Allingham <don@gramps-project.org>
|
2006-02-11 Don Allingham <don@gramps-project.org>
|
||||||
* src/GrampsMime.py: detect directory type
|
* src/GrampsMime.py: detect directory type
|
||||||
* src/ImageSelect.py: don't allow directory types to be added
|
* src/ImageSelect.py: don't allow directory types to be added
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2005 Donald N. Allingham
|
# Copyright (C) 2000-2006 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -55,7 +55,11 @@ import TarFile
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def impData(database, name,cb=None,cl=0):
|
def impData(database, name,cb=None,cl=0):
|
||||||
# Create tempdir, if it does not exist, then check for writability
|
# Create tempdir, if it does not exist, then check for writability
|
||||||
tmpdir_path = os.path.expanduser("~/.gramps/tmp" )
|
# THE TEMP DIR is named as the filname.gpkg.media and is created
|
||||||
|
# in the same dir as the database that we are importing into.
|
||||||
|
db_path = os.path.dirname(database.get_save_path())
|
||||||
|
media_dir = "%s.media" % os.path.basename(name)
|
||||||
|
tmpdir_path = os.path.join(db_path,media_dir)
|
||||||
if not os.path.isdir(tmpdir_path):
|
if not os.path.isdir(tmpdir_path):
|
||||||
try:
|
try:
|
||||||
os.mkdir(tmpdir_path,0700)
|
os.mkdir(tmpdir_path,0700)
|
||||||
@@ -79,20 +83,23 @@ def impData(database, name,cb=None,cl=0):
|
|||||||
ErrorDialog(_("Error extracting into %s") % tmpdir_path)
|
ErrorDialog(_("Error extracting into %s") % tmpdir_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
dbname = os.path.join(tmpdir_path,const.xmlFile)
|
imp_db_name = os.path.join(tmpdir_path,const.xmlFile)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ReadXML.importData(database,dbname,cb)
|
ReadXML.importData(database,imp_db_name,cb)
|
||||||
except:
|
except:
|
||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
|
|
||||||
# Clean up tempdir after ourselves
|
# Clean up tempdir after ourselves
|
||||||
files = os.listdir(tmpdir_path)
|
# THIS HAS BEEN CHANGED, because now we want to keep images
|
||||||
for filename in files:
|
# stay after the import is over. Just delete the XML file.
|
||||||
os.remove(os.path.join(tmpdir_path,filename))
|
os.remove(imp_db_name)
|
||||||
|
|
||||||
os.rmdir(tmpdir_path)
|
## files = os.listdir(tmpdir_path)
|
||||||
|
## for filename in files:
|
||||||
|
## os.remove(os.path.join(tmpdir_path,filename))
|
||||||
|
## os.rmdir(tmpdir_path)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user