summaryrefslogtreecommitdiff
path: root/mailman/database/mailinglist.py
diff options
context:
space:
mode:
authorBarry Warsaw2009-01-16 21:04:21 -0500
committerBarry Warsaw2009-01-16 21:04:21 -0500
commitae3d0cc316b826b8325507d960ccf84da601c3b0 (patch)
tree3485e2ca463c2131a0ffb1693bc60d569cc9d8b7 /mailman/database/mailinglist.py
parenta3f7d07c62b2f7d6ac9d0b700883826c2838db60 (diff)
downloadmailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.gz
mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.tar.zst
mailman-ae3d0cc316b826b8325507d960ccf84da601c3b0.zip
Several important cleanups.
* Turn on absolute_import and unicode_literals everywhere, and deal with the aftermath. * Use 'except X as Y' everywhere. * Make the module prologues much more consistent. * Use '{}'.format() consistently, except for logger interface. * Because of the problems with calling ** args with unicode keywords, hide calls to Template.substitute() behind an API.
Diffstat (limited to 'mailman/database/mailinglist.py')
-rw-r--r--mailman/database/mailinglist.py39
1 files changed, 25 insertions, 14 deletions
diff --git a/mailman/database/mailinglist.py b/mailman/database/mailinglist.py
index 56caea296..fb45afe96 100644
--- a/mailman/database/mailinglist.py
+++ b/mailman/database/mailinglist.py
@@ -15,6 +15,16 @@
# You should have received a copy of the GNU General Public License along with
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
+"""Model for mailing lists."""
+
+from __future__ import absolute_import, unicode_literals
+
+__metaclass__ = type
+__all__ = [
+ 'MailingList',
+ ]
+
+
import os
import string
@@ -28,6 +38,7 @@ from mailman.database import roster
from mailman.database.model import Model
from mailman.database.types import Enum
from mailman.interfaces.mailinglist import IMailingList, Personalization
+from mailman.utilities.string import expand
SPACE = ' '
@@ -220,42 +231,42 @@ class MailingList(Model):
@property
def no_reply_address(self):
- return '%s@%s' % (config.mailman.noreply_address, self.host_name)
+ return '{0}@{1}'.format(config.mailman.noreply_address, self.host_name)
@property
def owner_address(self):
- return '%s-owner@%s' % (self.list_name, self.host_name)
+ return '{0}-owner@{1}'.format(self.list_name, self.host_name)
@property
def request_address(self):
- return '%s-request@%s' % (self.list_name, self.host_name)
+ return '{0}-request@{1}'.format(self.list_name, self.host_name)
@property
def bounces_address(self):
- return '%s-bounces@%s' % (self.list_name, self.host_name)
+ return '{0}-bounces@{1}'.format(self.list_name, self.host_name)
@property
def join_address(self):
- return '%s-join@%s' % (self.list_name, self.host_name)
+ return '{0}-join@{1}'.format(self.list_name, self.host_name)
@property
def leave_address(self):
- return '%s-leave@%s' % (self.list_name, self.host_name)
+ return '{0}-leave@{1}'.format(self.list_name, self.host_name)
@property
def subscribe_address(self):
- return '%s-subscribe@%s' % (self.list_name, self.host_name)
+ return '{0}-subscribe@{1}'.format(self.list_name, self.host_name)
@property
def unsubscribe_address(self):
- return '%s-unsubscribe@%s' % (self.list_name, self.host_name)
+ return '{0}-unsubscribe@{1}'.format(self.list_name, self.host_name)
def confirm_address(self, cookie):
- template = string.Template(config.mta.verp_confirm_format)
- local_part = template.safe_substitute(
- address = '%s-confirm' % self.list_name,
- cookie = cookie)
- return '%s@%s' % (local_part, self.host_name)
+ local_part = expand(config.mta.verp_confirm_format, dict(
+ address = '{0}-confirm'.format(self.list_name),
+ cookie = cookie))
+ return '{0}@{1}'.format(local_part, self.host_name)
def __repr__(self):
- return '<mailing list "%s" at %#x>' % (self.fqdn_listname, id(self))
+ return '<mailing list "{0}" at {1:#x}>'.format(
+ self.fqdn_listname, id(self))