summaryrefslogtreecommitdiff
path: root/Mailman/Cgi/edithtml.py
diff options
context:
space:
mode:
authorbwarsaw2001-11-05 23:28:41 +0000
committerbwarsaw2001-11-05 23:28:41 +0000
commitfec68744a725bf02c96ccd204c0a6837a3cb5ec6 (patch)
tree6d955b1c39dd68acf4e8813d8fe6fdc5a6ba62f8 /Mailman/Cgi/edithtml.py
parent1749bc07516a330b388040cc4b40c1e7ed4ab8b8 (diff)
downloadmailman-fec68744a725bf02c96ccd204c0a6837a3cb5ec6.tar.gz
mailman-fec68744a725bf02c96ccd204c0a6837a3cb5ec6.tar.zst
mailman-fec68744a725bf02c96ccd204c0a6837a3cb5ec6.zip
Diffstat (limited to 'Mailman/Cgi/edithtml.py')
-rw-r--r--Mailman/Cgi/edithtml.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/Mailman/Cgi/edithtml.py b/Mailman/Cgi/edithtml.py
index eee07540f..ae0b13d46 100644
--- a/Mailman/Cgi/edithtml.py
+++ b/Mailman/Cgi/edithtml.py
@@ -18,6 +18,7 @@
import os
import cgi
+import errno
from Mailman import Utils
from Mailman import MailList
@@ -151,9 +152,16 @@ def ChangeHTML(mlist, cgi_info, template_name, doc):
doc.AddItem('<hr>')
return
code = cgi_info['html_code'].value
- fp = open(os.path.join(mlist.fullpath(), mlist.preferred_language,
- template_name), 'w')
- fp.write(code)
- fp.close()
+ langdir = os.path.join(mlist.fullpath(), mlist.preferred_language)
+ # Make sure the directory exists
+ try:
+ os.mkdir(langdir, 02775)
+ except OSError, e:
+ if e.errno <> errno.EEXIST: raise
+ fp = open(os.path.join(langdir, template_name), 'w')
+ try:
+ fp.write(code)
+ finally:
+ fp.close()
doc.AddItem(Header(3, _('HTML successfully updated.')))
doc.AddItem('<hr>')