Pull in more conversion stuff from upstream
This commit is contained in:
parent
6ffc739b15
commit
cb2e7c7fd5
@ -10,6 +10,26 @@ from mailman.utilities.importer import NAME_MAPPINGS, member_moderation_action_m
|
||||
|
||||
KEYFILTER = ('submit')
|
||||
|
||||
|
||||
EXCLUDES = set((
|
||||
'accept_these_nonmembers',
|
||||
'delivery_status',
|
||||
'digest_members',
|
||||
'discard_these_nonmembers',
|
||||
'hold_these_nonmembers',
|
||||
'members',
|
||||
'reject_these_nonmembers',
|
||||
'user_options',
|
||||
) + tuple({
|
||||
# from `convert_to_uri` in mailman's `importer.py`
|
||||
'goodbye_msg': 'list:user:notice:goodbye',
|
||||
'msg_header': 'list:member:regular:header',
|
||||
'msg_footer': 'list:member:regular:footer',
|
||||
'digest_header': 'list:member:digest:header',
|
||||
'digest_footer': 'list:member:digest:footer',
|
||||
}.keys()))
|
||||
|
||||
|
||||
def msg(*args, **kwargs):
|
||||
print(*args, file=sys.stderr, **kwargs)
|
||||
|
||||
@ -20,13 +40,16 @@ def get_form_data(htmlfile):
|
||||
soup = BeautifulSoup(htmlfile.read(), 'html.parser')
|
||||
|
||||
for field in soup.find_all('textarea'):
|
||||
if field['name'] in EXCLUDES:
|
||||
continue
|
||||
|
||||
name = NAME_MAPPINGS.get(field['name'], field['name'])
|
||||
|
||||
if 'msg' in name:
|
||||
continue
|
||||
|
||||
data_clean[name] = [l for l in field.get_text().split('\n') if l != ""]
|
||||
|
||||
data_clean[name] = [line for line in field.get_text().split('\n') if
|
||||
line != ""]
|
||||
|
||||
for field in soup.find_all('input'):
|
||||
if field['type'].lower() in ('hidden', 'submit'):
|
||||
@ -89,6 +112,7 @@ if __name__ == "__main__":
|
||||
if bool(globalconfig.get('default_member_moderation', 0)):
|
||||
globalconfig['default_member_action'] = member_moderation_action_mapping(
|
||||
globalconfig.get('member_moderation_action')).name
|
||||
del globalconfig['default_member_moderation']
|
||||
else:
|
||||
globalconfig['default_member_action'] = Action.defer.name
|
||||
# Handle DMARC mitigations.
|
||||
@ -108,6 +132,7 @@ if __name__ == "__main__":
|
||||
globalconfig['dmarc_mitigate_action'] = dmarc_action_mapping(
|
||||
globalconfig.get('from_is_list', 0)).name
|
||||
globalconfig['dmarc_mitigate_unconditionally'] = True
|
||||
del globalconfig['from_is_list']
|
||||
else:
|
||||
globalconfig['dmarc_mitigate_action'] = dmarc_action_mapping(
|
||||
globalconfig.get('dmarc_moderation_action', 0)).name
|
||||
@ -120,8 +145,10 @@ if __name__ == "__main__":
|
||||
# archive_private key, treat the list as having private archives.
|
||||
if globalconfig.get('archive_private', True):
|
||||
globalconfig['archive_policy'] = ArchivePolicy.private.name
|
||||
del globalconfig['archive_private']
|
||||
else:
|
||||
globalconfig['archive_policy'] = ArchivePolicy.public.name
|
||||
del globalconfig['archive']
|
||||
else:
|
||||
globalconfig['archive_policy'] = ArchivePolicy.never.name
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user