diff options
| author | Barry Warsaw | 2008-03-12 18:35:16 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-03-12 18:35:16 -0400 |
| commit | 4e2070ca3d8bca288cbc2d96771a78c22a7ec031 (patch) | |
| tree | f03b64e57aaf43bc78187c4d52955b8f2c569d03 /mailman/configuration.py | |
| parent | 5ca899a81b547dd46197b8d51c7f51538ecde397 (diff) | |
| download | mailman-4e2070ca3d8bca288cbc2d96771a78c22a7ec031.tar.gz mailman-4e2070ca3d8bca288cbc2d96771a78c22a7ec031.tar.zst mailman-4e2070ca3d8bca288cbc2d96771a78c22a7ec031.zip | |
Diffstat (limited to 'mailman/configuration.py')
| -rw-r--r-- | mailman/configuration.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/mailman/configuration.py b/mailman/configuration.py index 1f82c8304..83fadac5d 100644 --- a/mailman/configuration.py +++ b/mailman/configuration.py @@ -48,6 +48,7 @@ class Configuration(object): self.domains = {} # email host -> web host self._reverse = None self.qrunners = {} + self.qrunner_shortcuts = {} self.QFILE_SCHEMA_VERSION = Version.QFILE_SCHEMA_VERSION def load(self, filename=None): @@ -212,22 +213,34 @@ class Configuration(object): def add_qrunner(self, name, count=1): """Convenient interface for adding additional qrunners. - name is the qrunner name and it must not include the 'Runner' suffix. - E.g. 'HTTP' or 'LMTP'. count is the number of qrunner slices to - create, by default, 1. + :param name: the qrunner name, which must not include the 'Runner' + suffix. E.g. 'HTTP' or 'LMTP'. + :param count: is the number of qrunner slices to create, default: 1. """ if name.startswith('.'): name = 'mailman.queue' + name self.qrunners[name] = count + # Calculate the queue runner shortcut name. + classname = name.rsplit('.', 1)[1] + if classname.endswith('Runner'): + shortname = classname[:-6].lower() + else: + shortname = classname + self.qrunner_shortcuts[shortname] = name def del_qrunner(self, name): """Remove the named qrunner so that it does not start. - name is the qrunner name and it must not include the 'Runner' suffix. + :param name: the qrunner name, which must not include the 'Runner' + suffix. """ if name.startswith('.'): name = 'mailman.queue' + name self.qrunners.pop(name) + for shortname, classname in self.qrunner_shortcuts: + if name == classname: + del self.qrunner_shortcuts[shortname] + break @property def paths(self): |
