diff options
| author | hmeland | 2000-04-09 13:42:22 +0000 |
|---|---|---|
| committer | hmeland | 2000-04-09 13:42:22 +0000 |
| commit | 0831789fa86026e9308713124bd1aad246489f21 (patch) | |
| tree | 8e660ad391fe843dcbce01aa716fe143b010a2c1 /Mailman/MailList.py | |
| parent | 752fbddc46deec6cedd0415777f1080dec8acb23 (diff) | |
| download | mailman-0831789fa86026e9308713124bd1aad246489f21.tar.gz mailman-0831789fa86026e9308713124bd1aad246489f21.tar.zst mailman-0831789fa86026e9308713124bd1aad246489f21.zip | |
The 'reply_to_address' configuration setting now has type
mm_cfg.Email, not mm_cfg.String.
Create(): Use Utils.list_exists().
Save(): If writing to fname_tmp failed, only try unlinking fname_tmp
if it in fact does exist.
CheckValues(): Use urlparse module to verify that neither the scheme
("http") nor the network location ("www.python.org") of the
web_page_url are empty. If either one is found to be empty, set
self.web_page_url to mm_cfg.DEFAULT_URL.
ApprovedAddMembers(): Some very minor performance improvements.
HasExplicitDest(): Had the order of arguments to re.match() wrong.
Diffstat (limited to 'Mailman/MailList.py')
| -rw-r--r-- | Mailman/MailList.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 6f35d0f9b..9a80f0f03 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -26,7 +26,8 @@ import marshal import string import errno import re -from types import StringType, IntType, DictType +from types import StringType, IntType, DictType, ListType +from urlparse import urlparse from Mailman import mm_cfg from Mailman import Utils @@ -456,7 +457,7 @@ the changes occurs on a developers mailing list. To support these types of mailing lists, select <tt>Explicit address</tt> and set the <tt>Reply-To:</tt> address below to point to the parallel list."""), - ('reply_to_address', mm_cfg.String, WIDTH, 0, + ('reply_to_address', mm_cfg.Email, WIDTH, 0, '''Explicit <tt>Reply-To:</tt> header.''', # Details for reply_to_address @@ -773,7 +774,7 @@ it will not be changed."""), return config_info def Create(self, name, admin, crypted_password): - if name in Utils.list_names(): + if Utils.list_exists(name): raise ValueError, 'List %s already exists.' % name Utils.ValidateEmail(admin) Utils.MakeDirTree(os.path.join(mm_cfg.LIST_DATA_DIR, name)) @@ -827,7 +828,8 @@ it will not be changed."""), marshal.dump(dict, fp) fp.close() except IOError, status: - os.unlink(fname_tmp) + if os.path.exists(fname_tmp): + os.unlink(fname_tmp) self.LogMsg('error', 'Failed config.db file write, retaining old state' '\n %s' % `status.args`) @@ -915,7 +917,12 @@ it will not be changed."""), def CheckValues(self): """Normalize selected values to known formats.""" - if self.web_page_url and self.web_page_url[-1] != '/': + if "" in urlparse(self.web_page_url)[:2]: + # Either the "scheme" or the "network location" part of the + # parsed URL is empty -- substitute faulty value with + # (hopefully sane) default. + self.web_page_url = mm_cfg.DEFAULT_URL + if self.web_page_url and self.web_page_url[-1] != '/': self.web_page_url = self.web_page_url + '/' def IsListInitialized(self): @@ -1052,13 +1059,11 @@ it will not be changed."""), admin_notif = 1 else: admin_notif = 0 - if type(passwords) is type([]): - pass - else: - # Type error -- ignore the original value + if type(passwords) is not ListType: + # Type error -- ignore whatever value(s) we were given passwords = [None] * len(names) - while len(passwords) < len(names): - passwords.append(None) + if len(passwords) < len(names): + passwords.extend([None] * (len(names) - len(passwords))) result = {} dirty = 0 for i in range(len(names)): @@ -1210,12 +1215,12 @@ it will not be changed."""), try: # The list alias in `stripped` is a user supplied regexp, # which could be malformed. - if stripped and re.match(recip, stripped): + if stripped and re.match(stripped, recip): return 1 except re.error: # `stripped' is a malformed regexp -- try matching # safely, with all non-alphanumerics backslashed: - if stripped and re.match(recip, re.escape(stripped)): + if stripped and re.match(re.escape(stripped), recip): return 1 return 0 |
