diff options
| author | bwarsaw | 1998-12-29 20:52:49 +0000 |
|---|---|---|
| committer | bwarsaw | 1998-12-29 20:52:49 +0000 |
| commit | 88bbd1fe351d9db2fdb8bbc23915bbcbc77d0eda (patch) | |
| tree | 7daae92dd7d51c80a9eadf41d14fd14f50053927 /Mailman/Cgi/admin.py | |
| parent | 568e67c2396e2374e7b61023ad992fbc365527e0 (diff) | |
| download | mailman-88bbd1fe351d9db2fdb8bbc23915bbcbc77d0eda.tar.gz mailman-88bbd1fe351d9db2fdb8bbc23915bbcbc77d0eda.tar.zst mailman-88bbd1fe351d9db2fdb8bbc23915bbcbc77d0eda.zip | |
ChangeOptions(): Rework the test for empty or whitespace-only blank
line in mass subscribe dialog. The old way didn't really work.
Diffstat (limited to 'Mailman/Cgi/admin.py')
| -rw-r--r-- | Mailman/Cgi/admin.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Mailman/Cgi/admin.py b/Mailman/Cgi/admin.py index e30f2e0cb..ef4b2f756 100644 --- a/Mailman/Cgi/admin.py +++ b/Mailman/Cgi/admin.py @@ -741,28 +741,38 @@ def ChangeOptions(lst, category, cgi_info, document): name_text = cgi_info['subscribees'].value name_text = string.replace(name_text, '\r', '') names = string.split(name_text, '\n') - if '' in names: - names.remove('') subscribe_success = [] subscribe_errors = [] send_welcome_msg = string.atoi(cgi_info["send_welcome_msg_to_this_batch"].value) - for new_name in map(string.strip,names): + for new_name in map(string.strip, names): digest = 0 if not lst.digestable: digest = 0 if not lst.nondigestable: digest = 1 try: - lst.ApprovedAddMember(new_name, (Utils.GetRandomSeed() + - Utils.GetRandomSeed()), digest, send_welcome_msg) + # catches blank lines or whitespace-only lines in mass + # subscribe dialog + if not new_name: + # TBD: we raise the exception here instead of just + # appending to subscribe_errors and doing a continue, + # because as of Python 1.5.2, this is not supported syntax + # (a continue inside the try inside a loop). + new_name = '<blank line>' + raise Errors.MMBadEmailError + lst.ApprovedAddMember( + new_name, + Utils.GetRandomSeed() + Utils.GetRandomSeed(), + digest, send_welcome_msg) subscribe_success.append(new_name) except Errors.MMAlreadyAMember: subscribe_errors.append((new_name, 'Already a member')) - except Errors.MMBadEmailError: - subscribe_errors.append((new_name, "Bad/Invalid email address")) + subscribe_errors.append( + (new_name, "Bad/Invalid email address")) except Errors.MMHostileAddress: - subscribe_errors.append((new_name, "Hostile Address (illegal characters)")) + subscribe_errors.append( + (new_name, "Hostile Address (illegal characters)")) if subscribe_success: document.AddItem(Header(5, "Successfully Subscribed:")) document.AddItem(apply(UnorderedList, tuple((subscribe_success)))) |
