sorted config options and added obvious default values
This commit is contained in:
parent
1b72e9afe7
commit
e07b7a6f38
2 changed files with 126 additions and 76 deletions
198
listconfig.py
198
listconfig.py
|
@ -1,88 +1,135 @@
|
||||||
from typing import Any, Dict, Iterable
|
from typing import Any, Dict, Iterable
|
||||||
|
|
||||||
from types import MathebauMLType
|
from listtypes import MathebauMLType as MLType
|
||||||
|
|
||||||
# source of which keys exist: https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/listconf.html
|
# source of which keys exist: https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/listconf.html
|
||||||
_DEFAULTS: Dict[str, Any] = {
|
_DEFAULTS: Dict[str, Any] = {
|
||||||
'acceptable_aliases': ['one@example.com', 'two@example.com'],
|
# individual
|
||||||
'accept_these_nonmembers': ['aperson@example.com'],
|
'display_name': None,
|
||||||
'admin_immed_notify': False,
|
'description': None,
|
||||||
'admin_notify_mchanges': True,
|
'info': None,
|
||||||
'administrivia': False,
|
'subject_prefix': None,
|
||||||
'advertised': False,
|
'acceptable_aliases': [],
|
||||||
'anonymous_list': True,
|
'accept_these_nonmembers': [], # TODO: for internal lists, allow @mathebau addresses?
|
||||||
|
'hold_these_nonmembers': [],
|
||||||
|
'reject_these_nonmembers': [],
|
||||||
|
'discard_these_nonmembers': [],
|
||||||
|
|
||||||
|
# type-specific
|
||||||
|
'advertised': {
|
||||||
|
MLType.internalPublic: True,
|
||||||
|
MLType.internalPrivate: False,
|
||||||
|
MLType.broadPublic: True,
|
||||||
|
MLType.broadPrivate: False,
|
||||||
|
},
|
||||||
|
'send_goodbye_message': False, # TODO: entscheiden was in diesen 4 zu tun
|
||||||
|
'send_welcome_message': False, # TODO
|
||||||
|
'admin_immed_notify': False, # TODO
|
||||||
|
'admin_notify_mchanges': True, # TODO
|
||||||
|
'default_member_action': {
|
||||||
|
MLType.internalPublic: 'accept',
|
||||||
|
MLType.internalPrivate: 'accept',
|
||||||
|
MLType.broadPublic: 'hold',
|
||||||
|
MLType.broadPrivate: 'hold',
|
||||||
|
},
|
||||||
|
'default_nonmember_action': {
|
||||||
|
MLType.internalPublic: 'hold', # TODO: wie strikt hier? erlauben?
|
||||||
|
MLType.internalPrivate: 'hold', # TODO: wie strikt hier? erlauben?
|
||||||
|
MLType.broadPublic: 'hold',
|
||||||
|
MLType.broadPrivate: 'hold',
|
||||||
|
},
|
||||||
|
'max_message_size': {
|
||||||
|
MLType.internalPublic: 0,
|
||||||
|
MLType.internalPrivate: 0,
|
||||||
|
MLType.broadPublic: 200,
|
||||||
|
MLType.broadPrivate: 200,
|
||||||
|
},
|
||||||
|
'subscription_policy': {
|
||||||
|
MLType.internalPublic: 'confirm',
|
||||||
|
MLType.internalPrivate: 'confirm_then_moderate',
|
||||||
|
MLType.broadPublic: 'confirm',
|
||||||
|
MLType.broadPrivate: 'confirm_then_moderate',
|
||||||
|
},
|
||||||
|
'unsubscription_policy': {
|
||||||
|
MLType.internalPublic: 'open',
|
||||||
|
MLType.internalPrivate: 'confirm',
|
||||||
|
MLType.broadPublic: 'open',
|
||||||
|
MLType.broadPrivate: 'confirm',
|
||||||
|
},
|
||||||
|
|
||||||
|
# general
|
||||||
|
# - list identity
|
||||||
|
'preferred_language': 'de',
|
||||||
|
'member_roster_visibility': 'members', # TODO: was hat das für Auswirkungen?
|
||||||
|
'gateway_to_mail': False,
|
||||||
|
'gateway_to_news': False,
|
||||||
|
'linked_newsgroup': '',
|
||||||
|
'newsgroup_moderation': 'moderated',
|
||||||
|
'nntp_prefix_subject_too': True,
|
||||||
|
# - automatic responses
|
||||||
|
'autorespond_owner': 'none',
|
||||||
|
'autoresponse_owner_text': '',
|
||||||
|
'autorespond_postings': 'none',
|
||||||
|
'autoresponse_postings_text': '',
|
||||||
|
'autorespond_requests': 'none',
|
||||||
|
'autoresponse_request_text': '',
|
||||||
|
'autoresponse_grace_period': '7d',
|
||||||
|
'respond_to_post_requests': True, # TODO: wie sieht diese Autoresponse aus?
|
||||||
|
# - alter messages
|
||||||
|
'personalize': 'none',
|
||||||
|
'filter_content': True, # TODO: entscheide folgende 5
|
||||||
|
'filter_extensions': ['.mkv'], # TODO
|
||||||
|
'filter_types': ['application/zip'], # TODO
|
||||||
|
'pass_extensions': ['.pdf'], # TODO
|
||||||
|
'pass_types': ['image/jpeg'], # TODO
|
||||||
|
'collapse_alternatives': False, # TODO: wie strikt sind wir? Hier True?
|
||||||
|
'filter_action': 'preserve', # TODO
|
||||||
|
'convert_html_to_plaintext': True, # TODO: wie strikt?
|
||||||
|
'anonymous_list': False,
|
||||||
|
'include_rfc2369_headers': True,
|
||||||
|
'allow_list_posts': False,
|
||||||
|
'reply_to_address': '',
|
||||||
|
'first_strip_reply_to': False,
|
||||||
|
'reply_goes_to_list': 'no_munging',
|
||||||
|
'posting_pipeline': 'default-posting-pipeline',
|
||||||
|
# - DMARC-Mitigations
|
||||||
|
'dmarc_mitigate_action': 'munge_from', # TODO: Serverteam fragen, was sie hier wollen
|
||||||
|
'dmarc_mitigate_unconditionally': False,
|
||||||
|
'dmarc_moderation_notice': 'Nachricht als DMARC-Gegenmaßnahme abgelehnt.',
|
||||||
|
'dmarc_wrapped_message_text': 'Diese Nachricht wurde eingepackt, da die DMARC-Sicherheitsrichtlinien'
|
||||||
|
' des sendenden Mailservers mit Mailinglisten inkompatibel sind.',
|
||||||
|
# - Digest
|
||||||
|
'digests_enabled': True,
|
||||||
|
'digest_send_periodic': True,
|
||||||
|
'digest_volume_frequency': 'monthly',
|
||||||
|
'digest_size_threshold': 30.0,
|
||||||
|
# - Message Acceptance
|
||||||
|
'require_explicit_destination': True,
|
||||||
|
'administrivia': True,
|
||||||
|
'emergency': False,
|
||||||
|
'max_num_recipients': '10',
|
||||||
|
# - Archiving
|
||||||
'archive_policy': 'never',
|
'archive_policy': 'never',
|
||||||
'archive_rendering_mode': 'text',
|
# - Member Policy
|
||||||
'autorespond_owner': 'respond_and_discard',
|
# --- only *_policy here, which is at type-specific
|
||||||
'autorespond_postings': 'respond_and_continue',
|
# - Bounce Processing
|
||||||
'autorespond_requests': 'respond_and_discard',
|
'process_bounces': True, # TODO: @Serverteam, what is your policy?
|
||||||
'autoresponse_grace_period': '45d',
|
'bounce_score_threshold': 5,
|
||||||
'autoresponse_owner_text': 'the owner',
|
'bounce_info_stale_after': '30d', # should be long enough for non-active mailinglists
|
||||||
'autoresponse_postings_text': 'the mailing list',
|
|
||||||
'autoresponse_request_text': 'the robot',
|
|
||||||
'bounce_info_stale_after': '5d',
|
|
||||||
'bounce_notify_owner_on_bounce_increment': False,
|
|
||||||
'bounce_notify_owner_on_disable': True,
|
'bounce_notify_owner_on_disable': True,
|
||||||
'bounce_notify_owner_on_removal': True,
|
'bounce_notify_owner_on_removal': True,
|
||||||
'bounce_score_threshold': 5,
|
'bounce_notify_owner_on_bounce_increment': False, # could be interesting, but probably only for debugging
|
||||||
'bounce_you_are_disabled_warnings': 3,
|
'bounce_you_are_disabled_warnings_interval': '3d',
|
||||||
'bounce_you_are_disabled_warnings_interval': '1d',
|
'bounce_you_are_disabled_warnings': 5,
|
||||||
|
# - those do not exist in Postorius' Webinterface
|
||||||
|
'archive_rendering_mode': 'text',
|
||||||
'forward_unrecognized_bounces_to': 'administrators',
|
'forward_unrecognized_bounces_to': 'administrators',
|
||||||
'filter_extensions': ['.mkv'],
|
'moderator_password': 'keinparkhaussondernmathebau',
|
||||||
'filter_types': ['application/zip'],
|
'max_days_to_hold': '42',
|
||||||
'process_bounces': True,
|
|
||||||
'discard_these_nonmembers': ['^name_*bperson*@example.com'],
|
|
||||||
'display_name': 'Fnords',
|
|
||||||
'description': 'This is my mailing list',
|
|
||||||
'include_rfc2369_headers': False,
|
|
||||||
'info': 'This is the mailing list information',
|
|
||||||
'allow_list_posts': False,
|
|
||||||
'digest_send_periodic': False,
|
|
||||||
'digest_size_threshold': 10.5,
|
|
||||||
'digest_volume_frequency': 'yearly',
|
|
||||||
'digests_enabled': False,
|
|
||||||
'dmarc_mitigate_action': 'munge_from',
|
|
||||||
'dmarc_mitigate_unconditionally': False,
|
|
||||||
'dmarc_moderation_notice': 'Some moderation notice',
|
|
||||||
'dmarc_wrapped_message_text': 'some message text',
|
|
||||||
'personalize': 'none',
|
|
||||||
'preferred_language': 'ja',
|
|
||||||
'posting_pipeline': 'virgin',
|
|
||||||
'filter_content': True,
|
|
||||||
'first_strip_reply_to': True,
|
|
||||||
'gateway_to_mail': True,
|
|
||||||
'gateway_to_news': True,
|
|
||||||
'linked_newsgroup': 'my.group',
|
|
||||||
'newsgroup_moderation': 'moderated',
|
|
||||||
'nntp_prefix_subject_too': False,
|
|
||||||
'convert_html_to_plaintext': True,
|
|
||||||
'collapse_alternatives': False,
|
|
||||||
'reject_these_nonmembers': ['^b[hello]*@example.com'],
|
|
||||||
'hold_these_nonmembers': ['^re[gG]ex@example.com'],
|
|
||||||
'reply_goes_to_list': 'point_to_list',
|
|
||||||
'reply_to_address': 'bee@example.com',
|
|
||||||
'require_explicit_destination': False,
|
|
||||||
'member_roster_visibility': 'members',
|
|
||||||
'send_goodbye_message': False,
|
|
||||||
'send_welcome_message': False,
|
|
||||||
'subject_prefix': '[ant]',
|
|
||||||
'subscription_policy': 'moderate',
|
|
||||||
'unsubscription_policy': 'confirm',
|
|
||||||
'default_member_action': 'hold',
|
|
||||||
'default_nonmember_action': 'discard',
|
|
||||||
'moderator_password': 'password',
|
|
||||||
'max_message_size': '500',
|
|
||||||
'respond_to_post_requests': True,
|
|
||||||
'max_days_to_hold': '20',
|
|
||||||
'max_num_recipients': '20',
|
|
||||||
'pass_extensions': ['.pdf'],
|
|
||||||
'pass_types': ['image/jpeg'],
|
|
||||||
'filter_action': 'preserve',
|
|
||||||
'emergency': False
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def get_single_default(key: str, listtype: MathebauMLType) -> Any:
|
def get_single_default(key: str, listtype: MLType) -> Any:
|
||||||
"""Get the default value for a single key of a specific list type"""
|
"""Get the default value for a single key of a specific list type"""
|
||||||
val = _DEFAULTS.get(key)
|
val = _DEFAULTS.get(key)
|
||||||
if isinstance(val, dict):
|
if isinstance(val, dict):
|
||||||
|
@ -95,7 +142,10 @@ def get_config_keys() -> Iterable[str]:
|
||||||
return _DEFAULTS.keys()
|
return _DEFAULTS.keys()
|
||||||
|
|
||||||
|
|
||||||
def get_default_config(listtype: MathebauMLType) -> Dict[str, Any]:
|
def get_default_config(listtype: MLType) -> Dict[str, Any]:
|
||||||
|
"""Get the default config set for a mailinglist of a given type.
|
||||||
|
|
||||||
|
Keys with value `None` should be set individually for each list."""
|
||||||
ret = dict()
|
ret = dict()
|
||||||
for key in get_config_keys():
|
for key in get_config_keys():
|
||||||
ret[key] = get_single_default(key, listtype)
|
ret[key] = get_single_default(key, listtype)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import enum
|
||||||
|
|
||||||
class MathebauMLType(enum.Enum):
|
class MathebauMLType(enum.Enum):
|
||||||
"""Different types of mailinglists at the mathebau."""
|
"""Different types of mailinglists at the mathebau."""
|
||||||
internPublic = 10
|
internalPublic = 10
|
||||||
internPrivate = 15
|
internalPrivate = 15
|
||||||
broadPublic = 20
|
broadPublic = 20
|
||||||
broadPrivate = 25
|
broadPrivate = 25
|
Loading…
Reference in a new issue