<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<META content="MSHTML 5.00.3103.1000" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>I modify The subscription script for my request.</FONT></DIV>
<DIV><FONT size=2>like this(msg include some Chinese Charactors.Never
mind)</FONT></DIV>
<DIV><FONT
size=2>--------------------------------------------------------------------#
This Python Program is wroten by Xiao.Bing<BR># 2000.11<BR>#
oz_subscribe.py</FONT></DIV>
<DIV><FONT size=2>"""Process subscription requests from oz_maillist
form."""<BR>import sys<BR>import os<BR>import string<BR>import cgi</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>from Mailman import Utils<BR>from Mailman import
MailList<BR>from Mailman import Errors<BR>from Mailman.htmlformat import
*<BR>from Mailman import mm_cfg<BR>from Mailman.Logging.Syslog import
syslog</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>def main():<BR> doc =
Document()<BR> parts =
Utils.GetPathPieces()<BR> if not
parts:<BR> doc.AddItem(Header(2,
"错误"))<BR>
doc.AddItem(Bold('未传送给CGI合法的参数!'))<BR>
print
doc.Format(bgcolor="#ffffff")<BR>
return<BR> <BR>
listname = string.lower(parts[0])<BR>
try:<BR> mlist =
MailList.MailList(listname)<BR>
mlist.IsListInitialized()<BR> except Errors.MMListError,
e:<BR> doc.AddItem(Header(2,
"错误"))<BR>
doc.AddItem(Bold('没有此邮件列表<em>%s</em>' %
listname))<BR> print
doc.Format(bgcolor="#ffffff")<BR>
syslog('error', 'No such list "%s": %s\n' % (listname,
e))<BR> return<BR>
try:<BR> process_form(mlist,
doc)<BR>
finally:<BR>
mlist.Save()<BR>
mlist.Unlock()</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>def process_form(mlist, doc):<BR> form =
cgi.FieldStorage()<BR> error = 0<BR> results
= ''</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2> # Preliminaries done, actual processing of
the form input below.<BR> <BR> if not
form.has_key("email"):<BR> error =
1<BR> results = results +
"你必须提供一个有效的Email地址.<br>"<BR>
#<BR> # define email so we don't get a
NameError below<BR> # with if email ==
mlist.GetListEmail() -scott<BR>
#<BR> email = ""<BR>
else:<BR> email =
form["email"].value</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2> remote =
remote_addr()<BR> if email ==
mlist.GetListEmail():<BR> error =
1<BR> if
remote:<BR>
remote = "Web site " + remote<BR>
else:<BR>
remote = "unidentified origin"<BR>
badremote = "\n\tfrom " + remote<BR>
syslog("mischief", "Attempt to self subscribe
%s:%s"<BR>
% (email, badremote))<BR> # results =
results + "You must not subscribe a list to
itself!<br>"<BR> results = results +
"不能自订阅邮件列表!<br>"<BR> #
缺省的文摘发布形式<BR> digest = mlist.digest_is_default</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2> if not
mlist.digestable:<BR> digest =
0<BR> elif not
mlist.nondigestable:<BR> digest =
1</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2> if not
error:<BR>
try:<BR> if
mlist.FindUser(email):<BR>
raise Errors.MMAlreadyAMember,
email<BR> if
digest:<BR>
digesting = "
digest"<BR>
else:<BR>
digesting =
""<BR>
mlist.AddMember(email, "", digest,
remote)<BR>
#<BR> # check for all the errors that
mlist.AddMember can throw<BR> #
options on the web page for this
cgi<BR>
#<BR> except
Errors.MMBadEmailError:<BR>
results = results +
("邮件列表服务器不接受此邮件地址为"<BR>
"合法的邮件地址.<p>")<BR> except
Errors.MMListError:<BR>
results = results +
("邮件列表服务器"<BR>
"不能接受订阅请求.<p>")<BR> except
Errors.MMSubscribeNeedsConfirmation:<BR>
results = results +
("订阅请求需要得到确认,"<BR>
"订阅确认信息将被发往"<BR>
"%s. 请注意:
"<BR>
"如果你不能及时确认,订阅将"<BR>
"不能生效!<p>" % email)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2> except
Errors.MMNeedApproval,
x:<BR> results
= results + ("订阅将被<em>延缓</em>
"<BR>
"因为 %s.
你的请求已经被"<BR>
"转发给邮件列表管理员."<BR>
"你将收到通知邮件<p>" % x)<BR> except
Errors.MMHostileAddress:<BR>
results = results +
("你的订阅被禁止,由于"<BR>
"你给的邮件地址是不可靠的.<p>")<BR> except
Errors.MMAlreadyAMember:<BR>
results = results +
"你已经订阅过了!<p>"<BR>
#<BR> # these shouldn't happen, but if
someone's futzing with the cgi<BR> #
they might -scott<BR>
#<BR> except
Errors.MMCantDigestError:<BR>
results = results +
\<BR>
"No one can subscribe to the digest of this
list!"<BR> except
Errors.MMMustDigestError:<BR>
results = results +
\<BR>
"This list only supports digest
subscriptions!"<BR>
else:<BR>
results = results +
\<BR>
"恭喜你!你已经成功的订阅了 %s 邮件列表.<p>" %
\<BR>
(mlist.real_name)<BR> PrintResults(mlist, results,
doc)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT size=2>def PrintResults(mlist, results, doc):<BR>
replacements = mlist.GetStandardReplacements()<BR>
replacements['<mm-results>'] = results<BR> output =
mlist.ParseTags('oz_sub_success.html', replacements)<BR>
doc.AddItem(output)<BR> print
doc.Format(bgcolor="#ffffff")</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><FONT size=2>def remote_addr():<BR> "Try to return the
remote addr, or if unavailable, None."<BR> if
os.environ.has_key('REMOTE_HOST'):<BR>
return os.environ['REMOTE_HOST']<BR> elif
os.environ.has_key('REMOTE_ADDR'):<BR>
return os.environ['REMOTE_ADDR']<BR>
else:<BR> return
None<BR>--------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2>I write a simple HTML code to invoke the script.</FONT></DIV>
<DIV><FONT size=2><form method="POST"
action="/mailman/oz_subscribe/oztime_tech"><BR> <p>Please Input
you email addr:&nbsp; <input type="text" name="email"
size="20"><input type="submit" value="subscribe to"
name="subscribe"></p> <BR></form></FONT></DIV>
<DIV><FONT
size=2>---------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT size=2>oz_subscribe is a CGI program produced by a script(PY) file
with same name.</FONT></DIV>
<DIV><FONT size=2>oztime_tech is a MailList name.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>But I get a error msg</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>
<H2>Bug in Mailman version 2.0rc1</H2>
<P>
<H3>We're sorry, we hit a bug!</H3>
<P>Please inform the webmaster for this site of this problem. Printing of
traceback and other system information has been explicitly inhibited, but the
webmaster can find this information in the Mailman error logs. </P>
<P>So I go to see the error log.I found nothing.(Before did these.I simply
cleared all content in the error log file)</P>
<P>Why?Who can help me?</P>
<P> </P></FONT></DIV></BODY></HTML>