summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1998-11-03 23:20:42 +0000
committerbwarsaw1998-11-03 23:20:42 +0000
commit98f9f8628c7f5598e7b13e9828d272073ae6e3e7 (patch)
tree0584068851f31393ace2c3d6b94c8b51d2465396
parente55826c1b4e78f3f2a5f0af7d7d34f878d4c6b1a (diff)
downloadmailman-98f9f8628c7f5598e7b13e9828d272073ae6e3e7.tar.gz
mailman-98f9f8628c7f5598e7b13e9828d272073ae6e3e7.tar.zst
mailman-98f9f8628c7f5598e7b13e9828d272073ae6e3e7.zip
-rw-r--r--Mailman/Utils.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index 0beb43478..baf9de2ea 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -484,13 +484,24 @@ def IsAdministrivia(msg):
return 0
-
-
-
-
-
-
-
-
+def reraise(exc):
+ """Use this function to re-raise an exception.
+ This implementation hides the differences between Python versions.
+ """
+ # Python 1.5.2
+ # raise
+ # Earlier Python versions
+ raise exc, None, sys.exc_info()[2]
+def mkdir(dir, mode=02770):
+ """Wraps os.mkdir() in a umask saving try/finally.
+Two differences from os.mkdir():
+ - umask is forced to 0 during mkdir()
+ - default mode is 02770
+"""
+ ou = os.umask(0)
+ try:
+ os.mkdir(dir, mode)
+ finally:
+ os.umask(ou)