diff options
| author | klm | 1998-03-07 20:07:54 +0000 |
|---|---|---|
| committer | klm | 1998-03-07 20:07:54 +0000 |
| commit | 9b20c4287b96424ca0ef771c9958b1d363080820 (patch) | |
| tree | d4358860d6468df1bef28a16b0c728a1fb53a131 /modules/mm_utils.py | |
| parent | 9606b26c8e240f32f258941d3a9cdba29d3415c7 (diff) | |
| download | mailman-9b20c4287b96424ca0ef771c9958b1d363080820.tar.gz mailman-9b20c4287b96424ca0ef771c9958b1d363080820.tar.zst mailman-9b20c4287b96424ca0ef771c9958b1d363080820.zip | |
MakeDirTree: use umask 774 rathern than 744, so group members doing
development have access, also. More importantly, zero the umask
before actually creating the dir (and restore it afterwards), so the
permissions are exactly as specified,
Also wrapped a long line.
Diffstat (limited to 'modules/mm_utils.py')
| -rw-r--r-- | modules/mm_utils.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/mm_utils.py b/modules/mm_utils.py index 5869cc91d..12e46c99a 100644 --- a/modules/mm_utils.py +++ b/modules/mm_utils.py @@ -67,16 +67,21 @@ def GetPathPieces(path): pass return l -def MakeDirTree(path, perms=0744, verbose=0): +def MakeDirTree(path, perms=0774, verbose=0): made_part = '/' path_parts = GetPathPieces(path) for item in path_parts: made_part = os.path.join(made_part, item) if os.path.exists(made_part): if not os.path.isdir(made_part): - raise "RuntimeError", "Couldn't make dir tree for %s. (%s already exists)" % (path, made_part) + raise "RuntimeError", ("Couldn't make dir tree for %s. (%s" + " already exists)" % (path, made_part)) else: - os.mkdir(made_part, perms) + ou = os.umask(0) + try: + os.mkdir(made_part, perms) + finally: + os.umask(ou) if verbose: print 'made directory: ', madepart |
