[Mailman-Users] I Can't get any error msg!!!
Xiao Bing
xiao.bing at oztime.com
Wed Nov 1 09:10:37 CET 2000
I modify The subscription script for my request.
like this(msg include some Chinese Charactors.Never mind)
--------------------------------------------------------------------# This Python Program is wroten by Xiao.Bing
# 2000.11
# oz_subscribe.py
"""Process subscription requests from oz_maillist form."""
import sys
import os
import string
import cgi
from Mailman import Utils
from Mailman import MailList
from Mailman import Errors
from Mailman.htmlformat import *
from Mailman import mm_cfg
from Mailman.Logging.Syslog import syslog
def main():
doc = Document()
parts = Utils.GetPathPieces()
if not parts:
doc.AddItem(Header(2, "´íÎó"))
doc.AddItem(Bold('δ´«Ë͸øCGIºÏ·¨µÄ²ÎÊý!'))
print doc.Format(bgcolor="#ffffff")
return
listname = string.lower(parts[0])
try:
mlist = MailList.MailList(listname)
mlist.IsListInitialized()
except Errors.MMListError, e:
doc.AddItem(Header(2, "´íÎó"))
doc.AddItem(Bold('ûÓдËÓʼþÁбí<em>%s</em>' % listname))
print doc.Format(bgcolor="#ffffff")
syslog('error', 'No such list "%s": %s\n' % (listname, e))
return
try:
process_form(mlist, doc)
finally:
mlist.Save()
mlist.Unlock()
def process_form(mlist, doc):
form = cgi.FieldStorage()
error = 0
results = ''
# Preliminaries done, actual processing of the form input below.
if not form.has_key("email"):
error = 1
results = results + "Äã±ØÐëÌṩһ¸öÓÐЧµÄEmailµØÖ·.<br>"
#
# define email so we don't get a NameError below
# with if email == mlist.GetListEmail() -scott
#
email = ""
else:
email = form["email"].value
remote = remote_addr()
if email == mlist.GetListEmail():
error = 1
if remote:
remote = "Web site " + remote
else:
remote = "unidentified origin"
badremote = "\n\tfrom " + remote
syslog("mischief", "Attempt to self subscribe %s:%s"
% (email, badremote))
# results = results + "You must not subscribe a list to itself!<br>"
results = results + "²»ÄÜ×Ô¶©ÔÄÓʼþÁбí!<br>"
# ȱʡµÄÎÄÕª·¢²¼ÐÎʽ
digest = mlist.digest_is_default
if not mlist.digestable:
digest = 0
elif not mlist.nondigestable:
digest = 1
if not error:
try:
if mlist.FindUser(email):
raise Errors.MMAlreadyAMember, email
if digest:
digesting = " digest"
else:
digesting = ""
mlist.AddMember(email, "", digest, remote)
#
# check for all the errors that mlist.AddMember can throw
# options on the web page for this cgi
#
except Errors.MMBadEmailError:
results = results + ("ÓʼþÁбí·þÎñÆ÷²»½ÓÊÜ´ËÓʼþµØַΪ"
"ºÏ·¨µÄÓʼþµØÖ·.<p>")
except Errors.MMListError:
results = results + ("ÓʼþÁбí·þÎñÆ÷"
"²»ÄܽÓÊܶ©ÔÄÇëÇó.<p>")
except Errors.MMSubscribeNeedsConfirmation:
results = results + ("¶©ÔÄÇëÇóÐèÒªµÃµ½È·ÈÏ,"
"¶©ÔÄÈ·ÈÏÐÅÏ¢½«±»·¢Íù"
"%s. Çë×¢Òâ: "
"Èç¹ûÄã²»Äܼ°Ê±È·ÈÏ,¶©ÔĽ«"
"²»ÄÜÉúЧ!<p>" % email)
except Errors.MMNeedApproval, x:
results = results + ("¶©ÔĽ«±»<em>ÑÓ»º</em> "
"ÒòΪ %s. ÄãµÄÇëÇóÒѾ±»"
"ת·¢¸øÓʼþÁбí¹ÜÀíÔ±."
"Ä㽫ÊÕµ½Í¨ÖªÓʼþ<p>" % x)
except Errors.MMHostileAddress:
results = results + ("ÄãµÄ¶©Ôı»½ûÖ¹,ÓÉÓÚ"
"Äã¸øµÄÓʼþµØÖ·ÊDz»¿É¿¿µÄ.<p>")
except Errors.MMAlreadyAMember:
results = results + "ÄãÒѾ¶©ÔĹýÁË!<p>"
#
# these shouldn't happen, but if someone's futzing with the cgi
# they might -scott
#
except Errors.MMCantDigestError:
results = results + \
"No one can subscribe to the digest of this list!"
except Errors.MMMustDigestError:
results = results + \
"This list only supports digest subscriptions!"
else:
results = results + \
"¹§Ï²Äã!ÄãÒѾ³É¹¦µÄ¶©ÔÄÁË %s ÓʼþÁбí.<p>" % \
(mlist.real_name)
PrintResults(mlist, results, doc)
def PrintResults(mlist, results, doc):
replacements = mlist.GetStandardReplacements()
replacements['<mm-results>'] = results
output = mlist.ParseTags('oz_sub_success.html', replacements)
doc.AddItem(output)
print doc.Format(bgcolor="#ffffff")
def remote_addr():
"Try to return the remote addr, or if unavailable, None."
if os.environ.has_key('REMOTE_HOST'):
return os.environ['REMOTE_HOST']
elif os.environ.has_key('REMOTE_ADDR'):
return os.environ['REMOTE_ADDR']
else:
return None
--------------------------------------------------------------------------
I write a simple HTML code to invoke the script.
<form method="POST" action="/mailman/oz_subscribe/oztime_tech">
<p>Please Input you email addr: <input type="text" name="email" size="20"><input type="submit" value="subscribe to" name="subscribe"></p>
</form>
---------------------------------------------------------------------------
oz_subscribe is a CGI program produced by a script(PY) file with same name.
oztime_tech is a MailList name.
But I get a error msg
Bug in Mailman version 2.0rc1
We're sorry, we hit a bug!
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.
So I go to see the error log.I found nothing.(Before did these.I simply cleared all content in the error log file)
Why?Who can help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/mailman-users/attachments/20001101/118e66c7/attachment.html
More information about the Mailman-Users
mailing list