diff options
| author | Barry Warsaw | 2014-12-15 11:12:13 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2014-12-15 11:12:13 -0500 |
| commit | d0c53890bf0c8aa531d45958f0e25fdaccbdb133 (patch) | |
| tree | a4a4e4b1cb48b08540fb809cd06bf272f69f4c6a /src/mailman/config/config.py | |
| parent | bdc9795891a6df7e1ae61204d0640339cf48ebee (diff) | |
| download | mailman-d0c53890bf0c8aa531d45958f0e25fdaccbdb133.tar.gz mailman-d0c53890bf0c8aa531d45958f0e25fdaccbdb133.tar.zst mailman-d0c53890bf0c8aa531d45958f0e25fdaccbdb133.zip | |
* Read the .cfg files not as bytes any more, but as UTF-8 encoding files.
* Revert LP: #1170347 to not .as_string() the message being added the mailbox,
because Python 3.4 handles this properly by default.
Fix up some lmtp code, though I don't thinkk it's quite right yet.
Fix handler tests.
Diffstat (limited to 'src/mailman/config/config.py')
| -rw-r--r-- | src/mailman/config/config.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mailman/config/config.py b/src/mailman/config/config.py index c92485176..c6fe2041a 100644 --- a/src/mailman/config/config.py +++ b/src/mailman/config/config.py @@ -32,7 +32,7 @@ import sys from flufl.lock import Lock from lazr.config import ConfigSchema, as_boolean -from pkg_resources import resource_filename, resource_string +from pkg_resources import resource_filename, resource_string as resource_bytes from six.moves.configparser import ConfigParser, RawConfigParser from string import Template from unittest.mock import patch @@ -114,7 +114,7 @@ class Configuration: self._config = schema.load(config_file) if filename is not None: self.filename = filename - with open(filename) as user_config: + with open(filename, 'r', encoding='utf-8') as user_config: self.push(filename, user_config.read()) def push(self, config_name, config_string): @@ -286,9 +286,10 @@ def load_external(path, encoding=None): if path.startswith('python:'): resource_path = path[7:] package, dot, resource = resource_path.rpartition('.') - config_string = resource_string(package, resource + '.cfg') + raw = resource_bytes(package, resource + '.cfg') + config_string = raw.decode('utf-8') else: - with open(path, 'rb') as fp: + with open(path, 'r', encoding='utf-8') as fp: config_string = fp.read() if encoding is None: return config_string |
