diff options
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Handlers/Hold.py | 12 | ||||
-rw-r--r-- | Mailman/SecurityManager.py | 20 | ||||
-rw-r--r-- | Mailman/Utils.py | 8 |
3 files changed, 25 insertions, 15 deletions
diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index fdfaa09d..f6008d45 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 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 @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Determine whether this message should be held for approval. @@ -196,7 +197,12 @@ def hold_for_approval(mlist, msg, msgdata, exc): # BAW: This should really be tied into the email confirmation system so # that the message can be approved or denied via email as well as the # web. - if type(exc) is ClassType: + # + # XXX We use the weird type(type) construct below because in Python 2.1, + # type is a function not a type and so can't be used as the second + # argument in isinstance(). However, in Python 2.5, exceptions are + # new-style classes and so are not of ClassType. + if isinstance(exc, ClassType) or isinstance(exc, type(type)): # Go ahead and instantiate it now. exc = exc() listname = mlist.real_name diff --git a/Mailman/SecurityManager.py b/Mailman/SecurityManager.py index ba65fec2..01610b43 100644 --- a/Mailman/SecurityManager.py +++ b/Mailman/SecurityManager.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2004 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 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 @@ -12,7 +12,8 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. """Handle passwords and sanitize approved messages.""" @@ -347,11 +348,12 @@ splitter = re.compile(';\s*') def parsecookie(s): c = {} - for p in splitter.split(s): - try: - k, v = p.split('=', 1) - except ValueError: - pass - else: - c[k] = v + for line in s.splitlines(): + for p in splitter.split(line): + try: + k, v = p.split('=', 1) + except ValueError: + pass + else: + c[k] = v return c diff --git a/Mailman/Utils.py b/Mailman/Utils.py index 5218fed8..5c9707c7 100644 --- a/Mailman/Utils.py +++ b/Mailman/Utils.py @@ -443,6 +443,9 @@ def UnobscureEmail(addr): +class OuterExit(Exception): + pass + 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, @@ -509,7 +512,6 @@ def findtext(templatefile, dict=None, raw=False, lang=None, mlist=None): searchdirs.append(os.path.join(mm_cfg.TEMPLATE_DIR, 'site')) searchdirs.append(mm_cfg.TEMPLATE_DIR) # Start scanning - quickexit = 'quickexit' fp = None try: for lang in languages: @@ -517,12 +519,12 @@ def findtext(templatefile, dict=None, raw=False, lang=None, mlist=None): filename = os.path.join(dir, lang, templatefile) try: fp = open(filename) - raise quickexit + raise OuterExit except IOError, e: if e.errno <> errno.ENOENT: raise # Okay, it doesn't exist, keep looping fp = None - except quickexit: + except OuterExit: pass if fp is None: # Try one last time with the distro English template, which, unless |