summaryrefslogtreecommitdiff
path: root/src/mailman/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/utilities')
-rw-r--r--src/mailman/utilities/importer.py12
-rw-r--r--src/mailman/utilities/modules.py15
2 files changed, 17 insertions, 10 deletions
diff --git a/src/mailman/utilities/importer.py b/src/mailman/utilities/importer.py
index 99531194f..5b2be9742 100644
--- a/src/mailman/utilities/importer.py
+++ b/src/mailman/utilities/importer.py
@@ -128,12 +128,6 @@ def nonmember_action_mapping(value):
}[value]
-def int_to_bool(value):
- if value:
- return True
- else:
- return False
-
def check_language_code(code):
if code is None:
@@ -178,9 +172,9 @@ TYPES = dict(
personalize=Personalization,
preferred_language=check_language_code,
reply_goes_to_list=ReplyToMunging,
- allow_list_posts=int_to_bool,
- include_rfc2369_headers=int_to_bool,
- nntp_prefix_subject_too=int_to_bool,
+ allow_list_posts=bool,
+ include_rfc2369_headers=bool,
+ nntp_prefix_subject_too=bool,
)
diff --git a/src/mailman/utilities/modules.py b/src/mailman/utilities/modules.py
index 5dfec95db..9ff0e50cd 100644
--- a/src/mailman/utilities/modules.py
+++ b/src/mailman/utilities/modules.py
@@ -22,6 +22,7 @@ from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
'call_name',
+ 'expand_path',
'find_components',
'find_name',
'scan_module',
@@ -31,7 +32,7 @@ __all__ = [
import os
import sys
-from pkg_resources import resource_listdir
+from pkg_resources import resource_filename, resource_listdir
@@ -110,3 +111,15 @@ def find_components(package, interface):
continue
for component in scan_module(module, interface):
yield component
+
+
+
+def expand_path(url):
+ """Expand a python: path, returning the absolute file system path."""
+ # Is the context coming from a file system or Python path?
+ if url.startswith('python:'):
+ resource_path = url[7:]
+ package, dot, resource = resource_path.rpartition('.')
+ return resource_filename(package, resource + '.cfg')
+ else:
+ return url