diff --git a/src/mio/filecache.py b/src/mio/filecache.py index f5c79b14d30ff9a9698f79122b04edd1dd598505..b5bfd4bc9944c3437ef18d73e6f38cd1dc0f07d4 100755 --- a/src/mio/filecache.py +++ b/src/mio/filecache.py @@ -160,7 +160,7 @@ class FileCache: os.chmod(f.name, 0o700) return f - def loadfile(self, path, *name): + def loadfile(self, path, *name, mode=None): if not path in self.loader: # Create loader for new path up = urlparse(path) @@ -187,6 +187,8 @@ class FileCache: u.close() f.close() os.utime(f.name, (mtime, mtime)) + if mode != None: + os.chmod(f.name, 0o700) self.cache[key] = CacheEntry(f.name, key) pass pass @@ -244,10 +246,7 @@ expand_mirror = _cache.expand_mirror atexit.register(_cache.cleanup) def loadscript(path, *name): - result = loadfile(path, *name) - if result.filename in temp: - os.chmod(result.filename, 0o700) - return result + return loadfile(path, *name, mode=0o700) def localpath(prefix, *path): return os.path.normpath('/'.join(filter(None, [prefix] + list(path))))