summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
authorbwarsaw2003-05-12 15:20:07 +0000
committerbwarsaw2003-05-12 15:20:07 +0000
commit8acc76ee66cc11328a582b8b55e8c7e3fb52ee4f (patch)
tree462703a1226c8836a0817075c385bf7ad2d3746d /Mailman/Utils.py
parentc5d585492d1a04d41a50a5fd223379f39ad8d8ce (diff)
downloadmailman-8acc76ee66cc11328a582b8b55e8c7e3fb52ee4f.tar.gz
mailman-8acc76ee66cc11328a582b8b55e8c7e3fb52ee4f.tar.zst
mailman-8acc76ee66cc11328a582b8b55e8c7e3fb52ee4f.zip
Diffstat (limited to 'Mailman/Utils.py')
-rw-r--r--Mailman/Utils.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index 4a644342c..13e751a76 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -392,7 +392,7 @@ def UnobscureEmail(addr):
-def maketext(templatefile, dict=None, raw=False, lang=None, mlist=None):
+def findtext(templatefile, dict=None, raw=False, lang=None, mlist=None):
# Make some text from a template file. The order of searches depends on
# whether mlist and lang are provided. Once the templatefile is found,
# string substitution is performed by interpolation in `dict'. If `raw'
@@ -437,6 +437,12 @@ def maketext(templatefile, dict=None, raw=False, lang=None, mlist=None):
# on the above description. Mailman's upgrade script cannot do this for
# you.
#
+ # The function has been revised and renamed as it now returns both the
+ # template text and the path from which it retrieved the template. The
+ # original function is now a wrapper which just returns the template text
+ # as before, by calling this renamed function and discarding the second
+ # item returned.
+ #
# Calculate the languages to scan
languages = []
if lang is not None:
@@ -471,7 +477,8 @@ def maketext(templatefile, dict=None, raw=False, lang=None, mlist=None):
# Try one last time with the distro English template, which, unless
# you've got a really broken installation, must be there.
try:
- fp = open(os.path.join(mm_cfg.TEMPLATE_DIR, 'en', templatefile))
+ filename = os.path.join(mm_cfg.TEMPLATE_DIR, 'en', templatefile)
+ fp = open(filename)
except IOError, e:
if e.errno <> errno.ENOENT: raise
# We never found the template. BAD!
@@ -494,8 +501,12 @@ def maketext(templatefile, dict=None, raw=False, lang=None, mlist=None):
syslog('error', 'broken template: %s\n%s', filename, e)
pass
if raw:
- return text
- return wrap(text)
+ return text, filename
+ return wrap(text), filename
+
+
+def maketext(templatefile, dict=None, raw=False, lang=None, mlist=None):
+ return findtext(templatefile, dict, raw, lang, mlist)[0]