changeset 1901:86819d96cb01

SpellCheck:check write access to request.cfg.page_local_spelling_words
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 18 Mar 2007 23:26:58 +0100
parents 89fffad859b5 (current diff) 55617b3b1ac9 (diff)
children 0a6764ab0c16
files
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/caching.py	Sun Mar 18 23:19:49 2007 +0100
+++ b/MoinMoin/caching.py	Sun Mar 18 23:26:58 2007 +0100
@@ -9,6 +9,7 @@
 import os
 import tempfile
 
+from MoinMoin import config
 from MoinMoin.util import filesys, lock, pickle, PICKLE_PROTOCOL
 
 
@@ -118,6 +119,7 @@
                     os.close(tmp_handle)
                     # this is either atomic or happening with real locks set:
                     filesys.rename(tmp_fname, fname)
+                    filesys.chmod(fname, 0666 & config.umask) # fix mode that mkstemp chose
                 finally:
                     if self.locking:
                         self.wlock.release()
--- a/MoinMoin/util/filesys.py	Sun Mar 18 23:19:49 2007 +0100
+++ b/MoinMoin/util/filesys.py	Sun Mar 18 23:26:58 2007 +0100
@@ -13,6 +13,18 @@
 ### Misc Helpers
 #############################################################################
 
+def chmod(name, mode, catchexception=True):
+    """ change mode of some file/dir on platforms that support it.
+        usually you don't need this because we use os.umask() when importing
+        request.py
+    """
+    try:
+        os.chmod(name, mode)
+    except OSError:
+        if not catchexception:
+            raise
+
+
 def rename(oldname, newname):
     """ Multiplatform rename