diff options
| author | bwarsaw | 2001-05-01 06:03:00 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-05-01 06:03:00 +0000 |
| commit | a17501868e1f50aa3ba716eb9357d2727ca5d625 (patch) | |
| tree | 2a3035e499ef3525191f2e24981618150aef293a | |
| parent | 74847e2a59530fb4155eb87dc80b1a3bca63cc0e (diff) | |
| download | mailman-a17501868e1f50aa3ba716eb9357d2727ca5d625.tar.gz mailman-a17501868e1f50aa3ba716eb9357d2727ca5d625.tar.zst mailman-a17501868e1f50aa3ba716eb9357d2727ca5d625.zip | |
ScanMessages(): Use a better way to runtime import the module and call
its process() function. This doesn't require three nested getattr()
calls.
| -rw-r--r-- | Mailman/Bouncers/BouncerAPI.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Mailman/Bouncers/BouncerAPI.py b/Mailman/Bouncers/BouncerAPI.py index 022dcd92e..b6a4fc952 100644 --- a/Mailman/Bouncers/BouncerAPI.py +++ b/Mailman/Bouncers/BouncerAPI.py @@ -22,6 +22,7 @@ the filename containing the bounce message. """ +import sys import traceback from types import ListType @@ -50,10 +51,10 @@ def ScanMessages(mlist, msg, testing=0): 'SimpleMatch', 'Yale', ] - for modname in pipeline: - mod = __import__('Mailman.Bouncers.'+modname) - func = getattr(getattr(getattr(mod, 'Bouncers'), modname), 'process') - addrs = func(msg) + for module in pipeline: + modname = 'Mailman.Bouncers.' + module + __import__(modname) + addrs = sys.modules[modname].process(msg) if addrs: for addr in addrs: # we found a bounce or a list of bounce addrs |
