diff options
Diffstat (limited to 'Mailman/Utils.py')
-rw-r--r-- | Mailman/Utils.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py index b814f3d0..92262684 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -1,17 +1,17 @@ -# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2003 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -160,7 +160,7 @@ def wrap(text, column=70, honor_leading_ws=1): # end for text in lines # the last two newlines are bogus return wrapped[:-2] - + def QuotePeriods(text): @@ -232,7 +232,7 @@ def ScriptURL(target, web_page_url=None, absolute=0): fullpath = os.environ.get('SCRIPT_NAME', '') + \ os.environ.get('PATH_INFO', '') baseurl = urlparse.urlparse(web_page_url)[2] - if not absolute and fullpath[:len(baseurl)] == baseurl: + if not absolute and fullpath.endswith(baseurl): # Use relative addressing fullpath = fullpath[len(baseurl):] i = fullpath.find('?') @@ -254,7 +254,7 @@ def GetPossibleMatchingAddrs(name): For Example, given scott@pobox.com, return ['scott@pobox.com'], given scott@blackbox.pobox.com return ['scott@blackbox.pobox.com', 'scott@pobox.com']""" - + name = name.lower() user, domain = ParseEmail(name) res = [name] @@ -322,7 +322,7 @@ def set_global_password(pw, siteadmin=1): fp.close() finally: os.umask(omask) - + def get_global_password(siteadmin=1): if siteadmin: @@ -469,8 +469,10 @@ def maketext(templatefile, dict=None, raw=0, lang=None, mlist=None): # Try again after coercing the template to unicode utemplate = unicode(template, GetCharSet(lang), 'replace') text = sdict.interpolate(utemplate) - except (TypeError, ValueError): + except (TypeError, ValueError), e: # The template is really screwed up + from Mailman.Logging.Syslog import syslog + syslog('error', 'broken template: %s\n%s', filename, e) pass if raw: return text @@ -533,7 +535,7 @@ def is_administrivia(msg): return 1 return 0 - + def GetRequestURI(fallback=None, escape=1): """Return the full virtual path this CGI script was invoked with. @@ -590,6 +592,9 @@ def GetLanguageDescr(lang): def GetCharSet(lang): return mm_cfg.LC_DESCRIPTIONS[lang][1] +def IsLanguage(lang): + return mm_cfg.LC_DESCRIPTIONS.has_key(lang) + def get_domain(): |