diff options
| author | Barry Warsaw | 2009-03-29 15:40:22 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2009-03-29 15:40:22 -0500 |
| commit | 5388a2358749a1774bb801e6e6839c1798998a1f (patch) | |
| tree | 6bf6f2a10f1f1f588d5ca6d2f4c8ec8e6530cb4a /src/mailman/app/commands.py | |
| parent | f90c651d85050b9ad3b33bdf210672452d2ba1f0 (diff) | |
| download | mailman-5388a2358749a1774bb801e6e6839c1798998a1f.tar.gz mailman-5388a2358749a1774bb801e6e6839c1798998a1f.tar.zst mailman-5388a2358749a1774bb801e6e6839c1798998a1f.zip | |
Diffstat (limited to 'src/mailman/app/commands.py')
| -rw-r--r-- | src/mailman/app/commands.py | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/mailman/app/commands.py b/src/mailman/app/commands.py index cd4513629..7131defb4 100644 --- a/src/mailman/app/commands.py +++ b/src/mailman/app/commands.py @@ -25,9 +25,9 @@ __all__ = [ ] -import sys +from zope.interface.verify import verifyObject -from mailman import commands +from mailman.app.finder import find_components from mailman.config import config from mailman.interfaces.command import IEmailCommand @@ -35,19 +35,10 @@ from mailman.interfaces.command import IEmailCommand def initialize(): """Initialize the email commands.""" - for command_module in commands.__all__: - module_name = 'mailman.commands.' + command_module - __import__(module_name) - module = sys.modules[module_name] - for name in dir(module): - command_class = getattr(module, name) - try: - is_command = IEmailCommand.implementedBy(command_class) - except TypeError: - is_command = False - if not is_command: - continue - assert command_class.name not in config.commands, ( - 'Duplicate email command "{0}" found in {1}'.format( - command_class.name, module)) - config.commands[command_class.name] = command_class() + for command_class in find_components('mailman.commands', IEmailCommand): + command = command_class() + verifyObject(IEmailCommand, command) + assert command_class.name not in config.commands, ( + 'Duplicate email command "{0}" found in {1}'.format( + command_class.name, module)) + config.commands[command_class.name] = command_class() |
