comparison MoinMoin/caching.py @ 1317:76a76def8687

remove most chmod calls, use 1 os.umask() call in request module instead (port from 1.5)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 18 Aug 2006 21:20:15 +0200
parents c4f6af5ee295
children 8a89649ab5f0
comparison
equal deleted inserted replaced
1316:c4f6af5ee295 1317:76a76def8687
97 if not self.locking or self.locking and self.wlock.acquire(1.0): 97 if not self.locking or self.locking and self.wlock.acquire(1.0):
98 try: 98 try:
99 shutil.copyfile(filename, tmpfname) 99 shutil.copyfile(filename, tmpfname)
100 # this is either atomic or happening with real locks set: 100 # this is either atomic or happening with real locks set:
101 filesys.rename(tmpfname, fname) 101 filesys.rename(tmpfname, fname)
102 try:
103 os.chmod(self._filename(), 0666 & config.umask)
104 except OSError:
105 pass
106 finally: 102 finally:
107 if self.locking: 103 if self.locking:
108 self.wlock.release() 104 self.wlock.release()
109 else: 105 else:
110 self.request.log("Can't acquire write lock in %s" % self.lock_dir) 106 self.request.log("Can't acquire write lock in %s" % self.lock_dir)
122 f = open(tmpfname, 'wb') 118 f = open(tmpfname, 'wb')
123 f.write(content) 119 f.write(content)
124 f.close() 120 f.close()
125 # this is either atomic or happening with real locks set: 121 # this is either atomic or happening with real locks set:
126 filesys.rename(tmpfname, fname) 122 filesys.rename(tmpfname, fname)
127 try:
128 os.chmod(fname, 0666 & config.umask)
129 except OSError:
130 pass
131 finally: 123 finally:
132 if self.locking: 124 if self.locking:
133 self.wlock.release() 125 self.wlock.release()
134 else: 126 else:
135 self.request.log("Can't acquire write lock in %s" % self.lock_dir) 127 self.request.log("Can't acquire write lock in %s" % self.lock_dir)