summaryrefslogtreecommitdiff
path: root/src/mailman/utilities
diff options
context:
space:
mode:
authorBarry Warsaw2014-11-07 19:31:21 -0500
committerBarry Warsaw2014-11-07 19:31:21 -0500
commit249607949d5eab11e63e52cbac65e8a68327d593 (patch)
treec1ffefd2968aae1c040ec322ac918d5adfb4a5db /src/mailman/utilities
parent1d9f6970b9a26ee576838b53f485b96365e3a6c2 (diff)
downloadmailman-249607949d5eab11e63e52cbac65e8a68327d593.tar.gz
mailman-249607949d5eab11e63e52cbac65e8a68327d593.tar.zst
mailman-249607949d5eab11e63e52cbac65e8a68327d593.zip
Tox-ify the test suite. Now you don't have to create a virtualenv separately.
To do this, we have to handle random test ordering, since tox explicitly sets PYTHONHASHSEED. That's a good thing for the future Python 3 port. Removed `mailman conf -t/--sort`; now the output is always sorted. RFC 2369 headers are now sorted before being added. etag repr dicts are sorted using pprint.pformat().
Diffstat (limited to 'src/mailman/utilities')
-rw-r--r--src/mailman/utilities/importer.py18
-rw-r--r--src/mailman/utilities/tests/test_import.py5
2 files changed, 13 insertions, 10 deletions
diff --git a/src/mailman/utilities/importer.py b/src/mailman/utilities/importer.py
index baaa0e020..0523bb06f 100644
--- a/src/mailman/utilities/importer.py
+++ b/src/mailman/utilities/importer.py
@@ -308,13 +308,15 @@ def import_config_pck(mlist, config_dict):
'digest_header': 'digest_header_uri',
'digest_footer': 'digest_footer_uri',
}
- # The best we can do is convert only the most common ones.
- convert_placeholders = {
- '%(real_name)s': '$display_name',
- '%(real_name)s@%(host_name)s': '$fqdn_listname',
- '%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s':
- '$listinfo_uri',
- }
+ # The best we can do is convert only the most common ones. These are
+ # order dependent; the longer substitution with the common prefix must
+ # show up earlier.
+ convert_placeholders = [
+ ('%(real_name)s@%(host_name)s', '$fqdn_listname'),
+ ('%(real_name)s', '$display_name'),
+ ('%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s',
+ '$listinfo_uri'),
+ ]
# Collect defaults.
defaults = {}
for oldvar, newvar in convert_to_uri.items():
@@ -339,7 +341,7 @@ def import_config_pck(mlist, config_dict):
continue
text = config_dict[oldvar]
text = text.decode('utf-8', 'replace')
- for oldph, newph in convert_placeholders.items():
+ for oldph, newph in convert_placeholders:
text = text.replace(oldph, newph)
default_value, default_text = defaults.get(newvar, (None, None))
if not text and not (default_value or default_text):
diff --git a/src/mailman/utilities/tests/test_import.py b/src/mailman/utilities/tests/test_import.py
index e6eb9344c..be09a3256 100644
--- a/src/mailman/utilities/tests/test_import.py
+++ b/src/mailman/utilities/tests/test_import.py
@@ -501,8 +501,9 @@ class TestConvertToURI(unittest.TestCase):
))
loader = getUtility(ITemplateLoader)
text = loader.get(template_uri)
- self.assertEqual(text, expected_text,
- 'Old variables were not converted for %s' % newvar)
+ self.assertEqual(
+ text, expected_text,
+ 'Old variables were not converted for %s' % newvar)
def test_keep_default(self):
# If the value was not changed from MM2.1's default, don't import it.