* src/GrampsDbUtils/_Backup.py (__do_export): check for existance before deleting

2007-06-13  Don Allingham  <don@gramps-project.org>


svn: r8548
This commit is contained in:
Don Allingham 2007-06-14 04:26:46 +00:00
parent 06d9588736
commit 9b8759a25b
3 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,6 @@
2007-06-13 Don Allingham <don@gramps-project.org>
* src/GrampsDbUtils/_Backup.py (__do_export): check for existance before deleting
2007-06-13 Don Allingham <don@gramps-project.org>
* src/DbManager.py: handle cursor while rebuilding
* src/glade/gramps.glade: fix label placement

View File

@ -351,7 +351,8 @@ class DbManager:
# delete files that are not backup files or the .txt file
for filename in os.listdir(dirname):
if os.path.splitext(filename)[1] not in (".gbkp", ".txt"):
os.unlink(os.path.join(dirname,filename))
fname = os.path.join(dirname,filename)
os.unlink(fname)
dbclass = GrampsDb.gramps_db_factory(db_type = "x-directory/normal")
db = dbclass(Config.get(Config.TRANSACTIONS))

View File

@ -90,7 +90,8 @@ def __do_export(database):
for (base, tbl) in __build_tbl_map(database):
new_name = os.path.join(database.get_save_path(), base + ".gbkp")
old_name = new_name + ".new"
os.unlink(new_name)
if os.path.isfile(new_name):
os.unlink(new_name)
os.rename(old_name, new_name)
def restore(database):