* src/ReadXML.py (import_data), src/WriteXML.py (export_data),
src/RelImage.py (import_media_object), src/gramps_main.py (open_example), src/plugins/Check.py (cleanup_missing_photos), src/plugins/WebPage.py (write_gallery): Change shutil.copy() calls to first call shutil.copyfile() and then try setting up bits. svn: r1652
This commit is contained in:
parent
4b3fc4a2b4
commit
8edebcad36
@ -185,7 +185,11 @@ def importData(database, filename, callback,cl=0):
|
||||
def fs_ok_clicked(obj):
|
||||
name = fs_top.get_filename()
|
||||
if os.path.isfile(name):
|
||||
shutil.copy2(name,newfile)
|
||||
shutil.copyfile(name,newfile)
|
||||
try:
|
||||
shutil.copystat(name,newfile)
|
||||
except:
|
||||
pass
|
||||
Utils.destroy_passed_object(fs_top)
|
||||
|
||||
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
|
||||
@ -210,7 +214,11 @@ def importData(database, filename, callback,cl=0):
|
||||
ObjectMap[NewMediaID].setPath(newfile)
|
||||
ObjectMap[NewMediaID].setLocal(1)
|
||||
try:
|
||||
shutil.copy2(oldfile,newfile)
|
||||
shutil.copyfile(oldfile,newfile)
|
||||
try:
|
||||
shutil.copystat(oldfile,newfile)
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
if cl:
|
||||
print "Warning: media file %s was not found," \
|
||||
|
@ -82,7 +82,11 @@ def import_media_object(filename,path,base):
|
||||
return ""
|
||||
|
||||
try:
|
||||
shutil.copy(filename,name)
|
||||
shutil.copyfile(filename,name)
|
||||
try:
|
||||
shutil.copystat(filename,name)
|
||||
except:
|
||||
pass
|
||||
except IOError,msg:
|
||||
ErrorDialog(_("Error copying %s") % filename,str(msg))
|
||||
return ""
|
||||
@ -91,7 +95,11 @@ def import_media_object(filename,path,base):
|
||||
bname = os.path.basename(filename)
|
||||
l = string.split(bname,'.')
|
||||
name = "%s/%s.%s" % (path,base,l[-1])
|
||||
shutil.copy(filename,name)
|
||||
shutil.copyfile(filename,name)
|
||||
try:
|
||||
shutil.copystat(filename,name)
|
||||
except:
|
||||
pass
|
||||
|
||||
return name
|
||||
|
||||
|
@ -65,7 +65,11 @@ except:
|
||||
#-------------------------------------------------------------------------
|
||||
def exportData(database, filename, callback):
|
||||
if os.path.isfile(filename):
|
||||
shutil.copy(filename, filename + ".bak")
|
||||
shutil.copyfile(filename, filename + ".bak")
|
||||
try:
|
||||
shutil.copystat(filename, filename + ".bak")
|
||||
except:
|
||||
pass
|
||||
|
||||
compress = GrampsCfg.uncompress == 0 and _gzip_ok == 1
|
||||
|
||||
@ -78,7 +82,11 @@ def exportData(database, filename, callback):
|
||||
DisplayTrace.DisplayTrace()
|
||||
ErrorDialog(_("Failure writing %s") % filename,
|
||||
_("An attempt is being made to recover the original file"))
|
||||
shutil.copy(filename + ".bak", filename)
|
||||
shutil.copyfile(filename + ".bak", filename)
|
||||
try:
|
||||
shutil.copystat(filename + ".bak", filename)
|
||||
except:
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -2024,7 +2024,11 @@ class Gramps:
|
||||
try:
|
||||
dir = "%s/share/gramps/example" % const.prefixdir
|
||||
for file in os.listdir(dir):
|
||||
shutil.copy("%s/%s" % (dir,file), dest)
|
||||
shutil.copyfile("%s/%s" % (dir,file), dest)
|
||||
try:
|
||||
shutil.copystat("%s/%s" % (dir,file), dest)
|
||||
except:
|
||||
pass
|
||||
except IOError,msg:
|
||||
ErrorDialog(_('Example database not created'),str(msg))
|
||||
except OSError,msg:
|
||||
|
@ -142,7 +142,11 @@ class CheckIntegrity:
|
||||
def fs_ok_clicked(obj):
|
||||
name = fs_top.get_filename()
|
||||
if os.path.isfile(name):
|
||||
shutil.copy2(name,photo_name)
|
||||
shutil.copyfile(name,photo_name)
|
||||
try:
|
||||
shutil.copystat(name,photo_name)
|
||||
except:
|
||||
pass
|
||||
self.replaced_photo.append(ObjectMap[ObjectId])
|
||||
else:
|
||||
self.bad_photo.append(ObjectMap[ObjectId])
|
||||
|
@ -362,9 +362,17 @@ class IndividualPage:
|
||||
base = os.path.basename(src)
|
||||
|
||||
if self.image_dir:
|
||||
shutil.copy(src,"%s/%s/%s" % (self.dir,self.image_dir,base))
|
||||
shutil.copyfile(src,"%s/%s/%s" % (self.dir,self.image_dir,base))
|
||||
try:
|
||||
shutil.copystat(src,"%s/%s/%s" % (self.dir,self.image_dir,base))
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
shutil.copy(src,"%s/%s" % (self.dir,base))
|
||||
shutil.copyfile(src,"%s/%s" % (self.dir,base))
|
||||
try:
|
||||
shutil.copystat(src,"%s/%s" % (self.dir,base))
|
||||
except:
|
||||
pass
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell("ImageCell")
|
||||
|
Loading…
Reference in New Issue
Block a user