summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2001-02-23 23:59:48 +0000
committerbwarsaw2001-02-23 23:59:48 +0000
commit8ce9b298dffd15a1f5d44120b698348b70dad1e7 (patch)
tree17e0ebb9fad0a7ac870e503f3ddf22bfec46a83f
parentd6f9ed0fd31de8b3887876b10c1378309d3131eb (diff)
downloadmailman-8ce9b298dffd15a1f5d44120b698348b70dad1e7.tar.gz
mailman-8ce9b298dffd15a1f5d44120b698348b70dad1e7.tar.zst
mailman-8ce9b298dffd15a1f5d44120b698348b70dad1e7.zip
move_language_templates(): Move all the pre-2.1 templates from
lists/<listname> to lists/<listname>/en (after creating that subdir). dolist(): call move_language_templates()
-rwxr-xr-xbin/update30
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/update b/bin/update
index 2223f03dc..2dd5368e1 100755
--- a/bin/update
+++ b/bin/update
@@ -24,6 +24,7 @@ some previous version. It knows about versions back to 1.0b4 (?).
import sys
import os
import marshal
+import errno
import paths
from Mailman import mm_cfg
@@ -74,6 +75,30 @@ def makeabs(relpath):
+def move_language_templates(mlist):
+ print >> sys.stderr, 'Fixing language templates:', mlist.internal_name()
+ # In Mailman 2.1, each language gets its own templates under
+ # lists/<listname>. Since English is the default language for the
+ # templates, we want to move all the existing templates under
+ # lists/<listname> to lists/<listname>/en
+ listpath = mlist._full_path
+ en_path = os.path.join(listpath, 'en')
+ omask = os.umask(0)
+ try:
+ try:
+ os.mkdir(en_path, 02770)
+ except OSError, e:
+ if e.errno <> errno.EEXIST: raise
+ finally:
+ os.umask(omask)
+ # Now, move all the old template files to the new `en' directory
+ for file in [f for f in os.listdir(listpath)
+ if f.endswith('.txt') or f.endswith('.html')]:
+ os.rename(os.path.join(listpath, file),
+ os.path.join(listpath, 'en', file))
+
+
+
def dolist(listname):
errors = 0
mlist = MailList.MailList(listname, lock=0)
@@ -222,6 +247,11 @@ script.
else:
print "- both %s and %s exist, leaving untouched" \
% (o_tmpl, n_tmpl)
+ #
+ # Move all the templates to the en language subdirectory as required for
+ # Mailman 2.1
+ #
+ move_language_templates(mlist)
# Avoid eating filehandles with the list lockfiles
mlist.Unlock()
return 0