cubicweb/web/propertysheet.py
branch3.26
changeset 12288 2c582a242b66
parent 11965 fb03a4113979
child 12578 d06a2feae373
--- a/cubicweb/web/propertysheet.py	Thu Apr 19 12:45:24 2018 +0200
+++ b/cubicweb/web/propertysheet.py	Thu Apr 19 12:47:48 2018 +0200
@@ -109,6 +109,12 @@
             with os.fdopen(tmpfd, 'w') as stream:
                 stream.write(content)
             try:
+                mode = os.stat(sourcefile).st_mode
+                os.chmod(tmpfile, mode)
+            except IOError:
+                self.warning('Cannot set access mode for %s; you may encouter '
+                             'file permissions issues', cachefile)
+            try:
                 os.rename(tmpfile, cachefile)
             except OSError as err:
                 if err.errno != errno.EEXIST: