diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/app/lifecycle.py | 12 | ||||
| -rw-r--r-- | src/mailman/bin/genaliases.py | 2 | ||||
| -rw-r--r-- | src/mailman/bin/master.py | 2 | ||||
| -rw-r--r-- | src/mailman/bin/qrunner.py | 10 | ||||
| -rw-r--r-- | src/mailman/config/config.py | 6 | ||||
| -rw-r--r-- | src/mailman/database/pending.py | 2 | ||||
| -rw-r--r-- | src/mailman/database/types.py | 8 | ||||
| -rw-r--r-- | src/mailman/pipeline/scrubber.py | 6 | ||||
| -rw-r--r-- | src/mailman/queue/outgoing.py | 6 | ||||
| -rw-r--r-- | src/mailman/styles/manager.py | 6 |
10 files changed, 30 insertions, 30 deletions
diff --git a/src/mailman/app/lifecycle.py b/src/mailman/app/lifecycle.py index 5dfc0862d..56eb88d32 100644 --- a/src/mailman/app/lifecycle.py +++ b/src/mailman/app/lifecycle.py @@ -54,9 +54,9 @@ def create_list(fqdn_listname, owners=None): for style in config.style_manager.lookup(mlist): style.apply(mlist) # Coordinate with the MTA, as defined in the configuration file. - module_name, class_name = config.mta.incoming.rsplit('.', 1) - __import__(module_name) - getattr(sys.modules[module_name], class_name)().create(mlist) + package, dot, class_name = config.mta.incoming.rpartition('.') + __import__(package) + getattr(sys.modules[package], class_name)().create(mlist) # Create any owners that don't yet exist, and subscribe all addresses as # owners of the mailing list. usermgr = config.db.user_manager @@ -83,9 +83,9 @@ def remove_list(fqdn_listname, mailing_list=None, archives=True): # Delete the mailing list from the database. config.db.list_manager.delete(mailing_list) # Do the MTA-specific list deletion tasks - module_name, class_name = config.mta.incoming.rsplit('.', 1) - __import__(module_name) - getattr(sys.modules[module_name], class_name)().create(mailing_list) + package, dot, class_name = config.mta.incoming.rpartition('.') + __import__(package) + getattr(sys.modules[package], class_name)().create(mailing_list) # Remove the list directory. removeables.append(os.path.join(config.LIST_DATA_DIR, fqdn_listname)) # Remove any stale locks associated with the list. diff --git a/src/mailman/bin/genaliases.py b/src/mailman/bin/genaliases.py index e8916d030..fe587cb02 100644 --- a/src/mailman/bin/genaliases.py +++ b/src/mailman/bin/genaliases.py @@ -54,7 +54,7 @@ def main(): options.initialize() # Get the MTA-specific module. - module_path, class_path = config.mta.incoming.rsplit('.', 1) + package, dot, class_path = config.mta.incoming.rpartition('.') __import__(module_path) getattr(sys.modules[module_path], class_path)().regenerate() diff --git a/src/mailman/bin/master.py b/src/mailman/bin/master.py index d954bc865..1156f8a33 100644 --- a/src/mailman/bin/master.py +++ b/src/mailman/bin/master.py @@ -319,7 +319,7 @@ class Loop: qrunner_config = getattr(config, section_name) if not as_boolean(qrunner_config.start): continue - package, class_name = qrunner_config['class'].rsplit(DOT, 1) + package, dot, class_name = qrunner_config['class'].rpartition(DOT) __import__(package) # Let AttributeError propagate. class_ = getattr(sys.modules[package], class_name) diff --git a/src/mailman/bin/qrunner.py b/src/mailman/bin/qrunner.py index 9c02a5c4d..99cb564bc 100644 --- a/src/mailman/bin/qrunner.py +++ b/src/mailman/bin/qrunner.py @@ -133,9 +133,9 @@ def make_qrunner(name, slice, range, once=False): class_path = 'mailman.queue' + name else: class_path = name - module_name, class_name = class_path.rsplit('.', 1) + package, dot, class_name = class_path.rpartition('.') try: - __import__(module_name) + __import__(package) except ImportError, e: if config.options.options.subproc: # Exit with SIGTERM exit code so the master watcher won't try to @@ -145,7 +145,7 @@ def make_qrunner(name, slice, range, once=False): sys.exit(signal.SIGTERM) else: raise - qrclass = getattr(sys.modules[module_name], class_name) + qrclass = getattr(sys.modules[package], class_name) if once: # Subclass to hack in the setting of the stop flag in _do_periodic() class Once(qrclass): @@ -204,8 +204,8 @@ def main(): if options.options.list: descriptions = {} for section in config.qrunner_configs: - shortname = section.name.rsplit('.', 1)[-1] - classname = getattr(section, 'class').rsplit('.', 1)[-1] + ignore, dot, shortname = section.name.rpartition('.') + ignore, dot, classname = getattr(section, 'class').rpartition('.') descriptions[shortname] = classname longest = max(len(name) for name in descriptions) for shortname in sorted(descriptions): diff --git a/src/mailman/config/config.py b/src/mailman/config/config.py index 0e3f0dad7..1b86e8f67 100644 --- a/src/mailman/config/config.py +++ b/src/mailman/config/config.py @@ -191,9 +191,9 @@ class Configuration(object): if not as_boolean(section.enable): continue class_path = section['class'] - module_name, class_name = class_path.rsplit('.', 1) - __import__(module_name) - yield getattr(sys.modules[module_name], class_name)() + package, dot, class_name = class_path.rpartition('.') + __import__(package) + yield getattr(sys.modules[package], class_name)() @property def style_configs(self): diff --git a/src/mailman/database/pending.py b/src/mailman/database/pending.py index f4c2057e0..9c2da9064 100644 --- a/src/mailman/database/pending.py +++ b/src/mailman/database/pending.py @@ -146,7 +146,7 @@ class Pendings: PendedKeyValue.pended_id == pending.id): if keyvalue.value is not None and '\1' in keyvalue.value: typename, value = keyvalue.value.split('\1', 1) - package, classname = typename.rsplit('.', 1) + package, dot, classname = typename.rpartition('.') __import__(package) module = sys.modules[package] pendable[keyvalue.key] = getattr(module, classname)(value) diff --git a/src/mailman/database/types.py b/src/mailman/database/types.py index 2f901fe49..4b3031c3b 100644 --- a/src/mailman/database/types.py +++ b/src/mailman/database/types.py @@ -41,10 +41,10 @@ class _EnumVariable(Variable): return None if not from_db: return value - path, intvalue = value.rsplit(':', 1) - modulename, classname = path.rsplit('.', 1) - __import__(modulename) - cls = getattr(sys.modules[modulename], classname) + path, colon, intvalue = value.rpartition(':') + package, dot, classname = path.rpartition('.') + __import__(package) + cls = getattr(sys.modules[package], classname) return cls[int(intvalue)] def parse_get(self, value, to_db): diff --git a/src/mailman/pipeline/scrubber.py b/src/mailman/pipeline/scrubber.py index 115bc77d1..18d50c7a5 100644 --- a/src/mailman/pipeline/scrubber.py +++ b/src/mailman/pipeline/scrubber.py @@ -487,9 +487,9 @@ def save_attachment(mlist, msg, dir, filter_html=True): fp.close() # Now calculate the url to the list's archive. scrubber_path = config.scrubber.archive_scrubber - package_name, module_name = scrubber_path.rsplit('.', 1) - __import__(package_name) - baseurl = getattr(sys.modules[package_name], module_name).list_url(mlist) + package, dot, module_name = scrubber_path.rpartition('.') + __import__(package) + baseurl = getattr(sys.modules[package], module_name).list_url(mlist) if not baseurl.endswith('/'): baseurl += '/' # Trailing space will definitely be a problem with format=flowed. diff --git a/src/mailman/queue/outgoing.py b/src/mailman/queue/outgoing.py index fdb1289fd..2093534b4 100644 --- a/src/mailman/queue/outgoing.py +++ b/src/mailman/queue/outgoing.py @@ -45,9 +45,9 @@ class OutgoingRunner(Runner, BounceMixin): Runner.__init__(self, slice, numslices) BounceMixin.__init__(self) # We look this function up only at startup time. - module_name, callable_name = config.mta.outgoing.rsplit('.', 1) - __import__(module_name) - self._func = getattr(sys.modules[module_name], callable_name) + package, dot, callable_name = config.mta.outgoing.rpartition('.') + __import__(package) + self._func = getattr(sys.modules[package], callable_name) # This prevents smtp server connection problems from filling up the # error log. It gets reset if the message was successfully sent, and # set if there was a socket.error. diff --git a/src/mailman/styles/manager.py b/src/mailman/styles/manager.py index cf3d07711..e9682d7c5 100644 --- a/src/mailman/styles/manager.py +++ b/src/mailman/styles/manager.py @@ -52,9 +52,9 @@ class StyleManager: # Install all the styles described by the configuration files. for section in config.style_configs: class_path = section['class'] - module_name, class_name = class_path.rsplit('.', 1) - __import__(module_name) - style = getattr(sys.modules[module_name], class_name)() + package, dot, class_name = class_path.rpartition('.') + __import__(package) + style = getattr(sys.modules[package], class_name)() assert section.name.startswith('style'), ( 'Bad style section name: %s' % section.name) style.name = section.name[6:] |
