Coverage for src/postorius/forms/user_forms.py : 80%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- # Copyright (C) 2017-2019 by the Free Software Foundation, Inc. # # This file is part of Postorius. # # Postorius is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # Postorius is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # Postorius. If not, see <http://www.gnu.org/licenses/>. #
""" Form handling the user's global, address and subscription based preferences """
def initial(self): # Redirect to the preferences, this allows setting the preferences # after instanciation and it will also set the initial data.
def initial(self, value):
("plaintext_digests", _('Plain Text Digests')), ("mime_digests", _('Mime Digests')), ("summary_digests", _('Summary Digests'))) ("enabled", _('Enabled')), ("by_user", _('Disabled'))) widget=forms.RadioSelect, choices=delivery_status_choices, required=False, label=_('Delivery status'), help_text=_( 'Set this option to Enabled to receive messages posted to this ' 'mailing list. Set it to Disabled if you want to stay subscribed, ' 'but don\'t want mail delivered to you for a while (e.g. you\'re ' 'going on vacation). If you disable mail delivery, don\'t forget ' 'to re-enable it when you come back; it will not be automatically ' 're-enabled.')) widget=forms.Select(), choices=delivery_mode_choices, required=False, label=_('Delivery mode'), help_text=_( 'If you select summary digests , you\'ll get posts bundled ' 'together (usually one per day but possibly more on busy lists), ' 'instead of singly when they\'re sent. Your mail reader may or ' 'may not support MIME digests. In general MIME digests are ' 'preferred, but if you have a problem reading them, select ' 'plain text digests.')) widget=NullBooleanRadioSelect(choices=choices), required=False, label=_('Receive own postings'), help_text=_( 'Ordinarily, you will get a copy of every message you post to the ' 'list. If you don\'t want to receive this copy, set this option ' 'to No.' )) widget=NullBooleanRadioSelect(choices=choices), required=False, label=_('Acknowledge posts'), help_text=_( 'Receive acknowledgement mail when you send mail to the list?')) widget=NullBooleanRadioSelect(choices=choices), required=False, label=_('Hide address'), help_text=_( 'When someone views the list membership, your email address is ' 'normally shown (in an obscured fashion to thwart spam ' 'harvesters). ' 'If you do not want your email address to show up on this ' 'membership roster at all, select Yes for this option.')) widget=NullBooleanRadioSelect(choices=choices), required=False, label=_('Receive list copies (possible duplicates)'), help_text=_( 'When you are listed explicitly in the To: or Cc: headers of a ' 'list message, you can opt to not receive another copy from the ' 'mailing list. Select No to receive copies. ' 'Select Yes to avoid receiving copies from the mailing list'))
""" Class to define the name of the fieldsets and what should be included in each. """ "receive_list_copy", "receive_own_postings", "delivery_mode", "delivery_status"]]
if not self.changed_data: return for key in self.changed_data: if self.cleaned_data[key] is not None: # None: nothing set yet. Remember to remove this test # when Mailman accepts None as a "reset to default" # value. self._preferences[key] = self.cleaned_data[key] self._preferences.save()
for form in self.forms: form.save() |