summaryrefslogtreecommitdiff
path: root/Mailman
diff options
context:
space:
mode:
authorbwarsaw1999-03-08 21:32:05 +0000
committerbwarsaw1999-03-08 21:32:05 +0000
commitaf47e6bea61a158f3f9656f4b87048937bc55883 (patch)
tree9ee8a2a785aa7f095a9ca8a756da3108a51e0c1b /Mailman
parent5bd24de4b50ee873deed0cbce6fa5c5fa2b1538a (diff)
downloadmailman-af47e6bea61a158f3f9656f4b87048937bc55883.tar.gz
mailman-af47e6bea61a158f3f9656f4b87048937bc55883.tar.zst
mailman-af47e6bea61a158f3f9656f4b87048937bc55883.zip
Gross and digusting kludge to show the case preserved address for the
user (if different than their lowercased address). This could be done better if lists didn't have their own copies of options.html :-(
Diffstat (limited to 'Mailman')
-rw-r--r--Mailman/Cgi/options.py133
1 files changed, 68 insertions, 65 deletions
diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py
index e9cc764b9..fe2bad6c4 100644
--- a/Mailman/Cgi/options.py
+++ b/Mailman/Cgi/options.py
@@ -31,106 +31,109 @@ import sys
import os, string
from Mailman import Utils, MailList, htmlformat
from Mailman import mm_cfg
+from Mailman import Errors
def main():
doc = htmlformat.HeadlessDocument()
-
try:
path = os.environ['PATH_INFO']
except KeyError:
path = ""
list_info = Utils.GetPathPieces(path)
-
+ # sanity check options
if len(list_info) < 2:
doc.AddItem(htmlformat.Header(2, "Error"))
doc.AddItem(htmlformat.Bold("Invalid options to CGI script."))
print doc.Format()
sys.exit(0)
-
+ # get the list and user's name
list_name = string.lower(list_info[0])
user = Utils.UnobscureEmail(list_info[1])
-
+ # open list
try:
- list = MailList.MailList(list_name, lock=0)
- except:
- doc.AddItem(htmlformat.Header(2, "Error"))
- doc.AddItem(htmlformat.Bold("%s: No such list." % list_name ))
- print doc.Format()
- sys.exit(0)
-
- if not list._ready:
+ mlist = MailList.MailList(list_name, lock=0)
+ except Errors.MMUnknownListError:
+ doc.AddItem(htmlformat.Header(2, "Error"))
+ doc.AddItem(htmlformat.Bold("%s: No such list." % list_name ))
+ print doc.Format()
+ sys.exit(0)
+ # more list sanity checking
+ if not mlist._ready:
doc.AddItem(htmlformat.Header(2, "Error"))
doc.AddItem(htmlformat.Bold("%s: No such list." % list_name ))
print doc.Format()
sys.exit(0)
+ # Sanity check the user
user = Utils.LCDomain(user)
- if not list.members.has_key(user) \
- and not list.digest_members.has_key(user):
+ if not mlist.members.has_key(user) \
+ and not mlist.digest_members.has_key(user):
doc.AddItem(htmlformat.Header(2, "Error"))
doc.AddItem(htmlformat.Bold("%s: No such member %s."
% (list_name, `user`)))
- doc.AddItem(list.GetMailmanFooter())
+ doc.AddItem(mlist.GetMailmanFooter())
print doc.Format()
sys.exit(0)
-
- # Re-obscure the user's address for the page banner if obscure_addresses set.
- if list.obscure_addresses:
+ # find the case preserved email address (the one the user subscribed with)
+ cpuser = mlist.members.get(mlist.FindUser(user))
+ if cpuser <> 0:
+ user = user + ' (' + cpuser + ')'
+ # Re-obscure the user's address for the page banner if obscure_addresses
+ # set.
+ if mlist.obscure_addresses:
presentable_user = Utils.ObscureEmail(user, for_text=1)
else:
presentable_user = user
-
- replacements = list.GetStandardReplacements()
- replacements['<mm-digest-radio-button>'] = list.FormatOptionButton(
- mm_cfg.Digests, 1, user)
- replacements['<mm-undigest-radio-button>'] = list.FormatOptionButton(
- mm_cfg.Digests, 0, user)
- replacements['<mm-plain-digests-button>'] = list.FormatOptionButton(
- mm_cfg.DisableMime, 1, user)
- replacements['<mm-mime-digests-button>'] = list.FormatOptionButton(
- mm_cfg.DisableMime, 0, user)
- replacements['<mm-delivery-enable-button>'] = list.FormatOptionButton(
- mm_cfg.DisableDelivery, 0, user)
- replacements['<mm-delivery-disable-button>'] = list.FormatOptionButton(
- mm_cfg.DisableDelivery, 1, user)
- replacements['<mm-disabled-notice>'] = list.FormatDisabledNotice(user)
- replacements['<mm-dont-ack-posts-button>'] = list.FormatOptionButton(
- mm_cfg.AcknowlegePosts, 0, user)
- replacements['<mm-ack-posts-button>'] = list.FormatOptionButton(
- mm_cfg.AcknowlegePosts, 1, user)
- replacements['<mm-receive-own-mail-button>'] = list.FormatOptionButton(
- mm_cfg.DontReceiveOwnPosts, 0, user)
+ # Do replacements
+ replacements = mlist.GetStandardReplacements()
+ replacements['<mm-digest-radio-button>'] = mlist.FormatOptionButton(
+ mm_cfg.Digests, 1, user)
+ replacements['<mm-undigest-radio-button>'] = mlist.FormatOptionButton(
+ mm_cfg.Digests, 0, user)
+ replacements['<mm-plain-digests-button>'] = mlist.FormatOptionButton(
+ mm_cfg.DisableMime, 1, user)
+ replacements['<mm-mime-digests-button>'] = mlist.FormatOptionButton(
+ mm_cfg.DisableMime, 0, user)
+ replacements['<mm-delivery-enable-button>'] = mlist.FormatOptionButton(
+ mm_cfg.DisableDelivery, 0, user)
+ replacements['<mm-delivery-disable-button>'] = mlist.FormatOptionButton(
+ mm_cfg.DisableDelivery, 1, user)
+ replacements['<mm-disabled-notice>'] = mlist.FormatDisabledNotice(user)
+ replacements['<mm-dont-ack-posts-button>'] = mlist.FormatOptionButton(
+ mm_cfg.AcknowlegePosts, 0, user)
+ replacements['<mm-ack-posts-button>'] = mlist.FormatOptionButton(
+ mm_cfg.AcknowlegePosts, 1, user)
+ replacements['<mm-receive-own-mail-button>'] = mlist.FormatOptionButton(
+ mm_cfg.DontReceiveOwnPosts, 0, user)
replacements['<mm-dont-receive-own-mail-button>'] = (
- list.FormatOptionButton(mm_cfg.DontReceiveOwnPosts, 1, user))
+ mlist.FormatOptionButton(mm_cfg.DontReceiveOwnPosts, 1, user))
replacements['<mm-public-subscription-button>'] = (
- list.FormatOptionButton(mm_cfg.ConcealSubscription, 0, user))
- replacements['<mm-hide-subscription-button>'] = list.FormatOptionButton(
- mm_cfg.ConcealSubscription, 1, user)
-
- replacements['<mm-digest-submit>'] = list.FormatButton('setdigest',
- 'Submit My Changes')
+ mlist.FormatOptionButton(mm_cfg.ConcealSubscription, 0, user))
+ replacements['<mm-hide-subscription-button>'] = mlist.FormatOptionButton(
+ mm_cfg.ConcealSubscription, 1, user)
+ replacements['<mm-digest-submit>'] = mlist.FormatButton(
+ 'setdigest', 'Submit My Changes')
replacements['<mm-unsubscribe-button>'] = (
- list.FormatButton('unsub', 'Unsubscribe'))
- replacements['<mm-digest-pw-box>'] = list.FormatSecureBox('digpw')
- replacements['<mm-unsub-pw-box>'] = list.FormatSecureBox('upw')
- replacements['<mm-old-pw-box>'] = list.FormatSecureBox('opw')
- replacements['<mm-new-pass-box>'] = list.FormatSecureBox('newpw')
- replacements['<mm-confirm-pass-box>'] = list.FormatSecureBox('confpw')
+ mlist.FormatButton('unsub', 'Unsubscribe'))
+ replacements['<mm-digest-pw-box>'] = mlist.FormatSecureBox('digpw')
+ replacements['<mm-unsub-pw-box>'] = mlist.FormatSecureBox('upw')
+ replacements['<mm-old-pw-box>'] = mlist.FormatSecureBox('opw')
+ replacements['<mm-new-pass-box>'] = mlist.FormatSecureBox('newpw')
+ replacements['<mm-confirm-pass-box>'] = mlist.FormatSecureBox('confpw')
replacements['<mm-other-subscriptions-pw-box>'] = (
- list.FormatSecureBox('othersubspw'))
+ mlist.FormatSecureBox('othersubspw'))
replacements['<mm-other-subscriptions-submit>'] = (
- list.FormatButton('othersubs',
- 'List my other subscriptions'))
+ mlist.FormatButton('othersubs',
+ 'List my other subscriptions'))
replacements['<mm-change-pass-button>'] = (
- list.FormatButton('changepw', "Change My Password"))
- replacements['<mm-form-start>'] = list.FormatFormStart('handle_opts', user)
+ mlist.FormatButton('changepw', "Change My Password"))
+ replacements['<mm-form-start>'] = (
+ mlist.FormatFormStart('handle_opts', user))
replacements['<mm-user>'] = user
replacements['<mm-presentable-user>'] = presentable_user
- replacements['<mm-email-my-pw>'] = list.FormatButton('emailpw',
- ('Email My Password'
- ' To Me'))
- replacements['<mm-umbrella-notice>'] = list.FormatUmbrellaNotice(user,
- "password")
-
-
- doc.AddItem(list.ParseTags('options.html', replacements))
+ replacements['<mm-email-my-pw>'] = mlist.FormatButton('emailpw',
+ ('Email My Password'
+ ' To Me'))
+ replacements['<mm-umbrella-notice>'] = (
+ mlist.FormatUmbrellaNotice(user, "password"))
+ doc.AddItem(mlist.ParseTags('options.html', replacements))
print doc.Format()