From 38f66a2f587025b696911b2e95113fa34f42e331 Mon Sep 17 00:00:00 2001 From: SNoiraud Date: Sat, 9 Jan 2016 10:20:32 +0100 Subject: [PATCH] 9163 : Narrative web : "errno: 1, operation is not permitted" when creating archive. --- gramps/plugins/webreport/narrativeweb.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index f3cd8628d..52c9b6e80 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -7989,9 +7989,19 @@ class NavWebReport(Report): # log.debug("copying '%s' to '%s/%s'" % (from_fname, to_dir, to_fname)) mtime = os.stat(from_fname).st_mtime if self.archive: + def set_mtime(tarinfo): + """ + For each file, we set the last modification time. + + We could also set uid, gid, uname, gname and mode + #tarinfo.uid = os.getuid() + #tarinfo.mode = 0660 + #tarinfo.uname = tarinfo.gname = "www-data" + """ + tarinfo.mtime = mtime + return tarinfo dest = os.path.join(to_dir, to_fname) - os.utime(from_fname, (mtime, mtime)) - self.archive.add(from_fname, dest) + self.archive.add(from_fname, dest, filter=set_mtime) else: dest = os.path.join(self.html_dir, to_dir, to_fname)