diff options
| author | bwarsaw | 2001-02-16 06:14:14 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-02-16 06:14:14 +0000 |
| commit | 5fc2b6cc704d3902a9cdfc1db45f18cac599ef58 (patch) | |
| tree | b5dc765e40f9c3582d522e967c2a1e2e453448c2 /Mailman | |
| parent | 93ecd98e59620200a4d7e028d62bfbf6d27e6e12 (diff) | |
| download | mailman-5fc2b6cc704d3902a9cdfc1db45f18cac599ef58.tar.gz mailman-5fc2b6cc704d3902a9cdfc1db45f18cac599ef58.tar.zst mailman-5fc2b6cc704d3902a9cdfc1db45f18cac599ef58.zip | |
MakeDirTree(): Remove (obsoleted by os.makedirs()).
maketext(): If the language specific template file doesn't exist, fall
back to using $MM/templates. This helps with bootstrapping but may
not be the correct long term solution.
Diffstat (limited to 'Mailman')
| -rw-r--r-- | Mailman/Utils.py | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index b54fee7ba..57f1261ce 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -249,26 +249,6 @@ def ScriptURL(target, web_page_url=None, absolute=0): -def MakeDirTree(path, perms=0775, verbose=0): - made_part = '/' - path_parts = filter(None, string.split(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)) - else: - ou = os.umask(0) - try: - os.mkdir(made_part, perms) - finally: - os.umask(ou) - if verbose: - print 'made directory: ', madepart - - - # This takes an email address, and returns a tuple containing (user,host) def ParseEmail(email): user = None @@ -487,7 +467,13 @@ def maketext(templatefile, dict=None, raw=0, lang=None): if dict is None: dict = {} file = os.path.join(mm_cfg.TEMPLATE_DIR, lang, templatefile) - fp = open(file) + try: + fp = open(file) + except IOError, e: + if e.errno <> errno.ENOENT: raise + # The language specific template directory may not yet exist + file = os.path.join(mm_cfg.TEMPLATE_DIR, templatefile) + fp = open(file) template = fp.read() fp.close() text = template % SafeDict(dict) |
