diff options
author | bwarsaw <> | 2006-07-30 19:35:36 +0000 |
---|---|---|
committer | bwarsaw <> | 2006-07-30 19:35:36 +0000 |
commit | e7cf2af0ec44ca0a09c847411ab0adce15c79093 (patch) | |
tree | 88d524b246e2e70e89a77ba0095d1e856944dbf7 /Mailman/Handlers | |
parent | c8b70cd189cc938a1a2fca32cf3f29f85c5e25ed (diff) | |
download | mailman2-e7cf2af0ec44ca0a09c847411ab0adce15c79093.tar.gz mailman2-e7cf2af0ec44ca0a09c847411ab0adce15c79093.tar.xz mailman2-e7cf2af0ec44ca0a09c847411ab0adce15c79093.zip |
Back port Python 2.5 compatibility changes to Mailman 2.1. Specifically,
- In SecurityManager.py, fix the parsecookie() code to work with Python 2.5
generated cookie text. The latter was changed to be more RFC compliant so
it does not output trailing semicolons for each line of cookie text. This
broke the splitting rules, so now first split on newlines, then on ';\s*'.
This should work across all Python versions.
- In Python 2.5, exceptions are new-style, and thus are no longer of
ClassType. The instantiation type test in hold_for_approval() was too
naive. This one is fixed differently here than in the MM trunk because in
Python 2.1, 'type' isn't a type, it's a function and so can't be used as the
second argument to isinstance() directly.
- Raising strings generates deprecation warnings in Python 2.5. Switch the
one weird use of this in Utils.py to use a class exception. Don't call it
"quick exit" though because it's probably not.
Diffstat (limited to 'Mailman/Handlers')
-rw-r--r-- | Mailman/Handlers/Hold.py | 12 |
1 files changed, 9 insertions, 3 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 |