summaryrefslogtreecommitdiff
path: root/Mailman/Cgi/options.py
diff options
context:
space:
mode:
authorbwarsaw1998-06-19 19:57:31 +0000
committerbwarsaw1998-06-19 19:57:31 +0000
commitaff327f7d375d3ccf5aa6a165f93d8d9454ce0ea (patch)
tree47ee88da43726e203f453c6cc80d386e11ed537e /Mailman/Cgi/options.py
parent002f566bfd5619df6c215bfe5597aeace7a59499 (diff)
downloadmailman-aff327f7d375d3ccf5aa6a165f93d8d9454ce0ea.tar.gz
mailman-aff327f7d375d3ccf5aa6a165f93d8d9454ce0ea.tar.zst
mailman-aff327f7d375d3ccf5aa6a165f93d8d9454ce0ea.zip
Diffstat (limited to 'Mailman/Cgi/options.py')
-rw-r--r--Mailman/Cgi/options.py167
1 files changed, 84 insertions, 83 deletions
diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py
index 07664bbb3..79575a87f 100644
--- a/Mailman/Cgi/options.py
+++ b/Mailman/Cgi/options.py
@@ -19,7 +19,7 @@
"""Produce user options form, from list options.html template.
Takes listname/userid in PATH_INFO, expecting an `obscured' userid. Depending
-on the mm_utils.{O,Uno}bscureEmail utilities tolerance, will work fine with an
+on the Utils.{O,Uno}bscureEmail utilities tolerance, will work fine with an
unobscured ids as well.
"""
@@ -29,97 +29,98 @@ unobscured ids as well.
import sys
import os, string
-import mm_utils, maillist, htmlformat, mm_cfg
+from Mailman import Utils, MailList, htmlformat
+from Mailman import mm_cfg
-doc = htmlformat.HeadlessDocument()
+def main():
+ doc = htmlformat.HeadlessDocument()
-try:
- path = os.environ['PATH_INFO']
-except KeyError:
- path = ""
-list_info = mm_utils.GetPathPieces(path)
+ try:
+ path = os.environ['PATH_INFO']
+ except KeyError:
+ path = ""
+ list_info = Utils.GetPathPieces(path)
-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)
+ 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)
-list_name = string.lower(list_info[0])
-user = mm_utils.UnobscureEmail(list_info[1])
+ list_name = string.lower(list_info[0])
+ user = Utils.UnobscureEmail(list_info[1])
-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)
+ 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:
- 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:
+ doc.AddItem(htmlformat.Header(2, "Error"))
+ doc.AddItem(htmlformat.Bold("%s: No such list." % list_name ))
+ print doc.Format()
+ sys.exit(0)
-if string.lower(user) not in list.members + list.digest_members:
- doc.AddItem(htmlformat.Header(2, "Error"))
- doc.AddItem(htmlformat.Bold("%s: No such member %s."
- % (list_name, `user`)))
- doc.AddItem(list.GetMailmanFooter())
- print doc.Format()
- sys.exit(0)
+ if string.lower(user) not in list.members + list.digest_members:
+ doc.AddItem(htmlformat.Header(2, "Error"))
+ doc.AddItem(htmlformat.Bold("%s: No such member %s."
+ % (list_name, `user`)))
+ doc.AddItem(list.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:
- presentable_user = mm_utils.ObscureEmail(user, for_text=1)
-else:
- presentable_user = user
+ # Re-obscure the user's address for the page banner if obscure_addresses set.
+ if list.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)
-replacements['<mm-dont-receive-own-mail-button>'] = list.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 = 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)
+ replacements['<mm-dont-receive-own-mail-button>'] = list.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')
-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')
-replacements['<mm-change-pass-button>'] = list.FormatButton('changepw',
- "Change My Password")
-replacements['<mm-form-start>'] = list.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-digest-submit>'] = list.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')
+ replacements['<mm-change-pass-button>'] = list.FormatButton('changepw',
+ "Change My Password")
+ replacements['<mm-form-start>'] = list.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')
-doc.AddItem(list.ParseTags('options.html', replacements))
-print doc.Format()
-
+ doc.AddItem(list.ParseTags('options.html', replacements))
+ print doc.Format()