mod_python - forms not working with publisher - Connection refused
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
WEBMASTER = "webmaster" # webmaster e-mail
SMTP_SERVER = "localhost" # your SMTP server
def email(req, name, email, comment):
# make sure the user provided all the parameters
if not (name and email and comment):
return "A required parameter is missing, \
please go back and correct the error"
# create the message text
msg = """\
I have the following comment:
""" % (email, WEBMASTER, comment, name)
# send it out
conn = smtplib.SMTP(SMTP_SERVER)
conn.sendmail(email, [WEBMASTER], msg)
# provide feedback to the user
s = """\
Thank You for your kind comments, we
will get back to you shortly.
</html>""" % name
with this apache config:
AddHandler mod_python .py
makes this error:
Traceback (most recent call last):
File "/local/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/local/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/local/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/local/lib/python2.5/site-packages/mod_python/publisher.py", line 213, in handler
published = publish_object(req, object)
File "/local/lib/python2.5/site-packages/mod_python/publisher.py", line 425, in publish_object
return publish_object(req,util.apply_fs_data(object, req.form, req=req))
File "/local/lib/python2.5/site-packages/mod_python/util.py", line 554, in apply_fs_data
File "/local/htdocs/python/form.py", line 30, in email
conn = smtplib.SMTP(SMTP_SERVER)
File "/local/lib/python2.5/smtplib.py", line 244, in __init__
(code, msg) = self.connect(host, port)
File "/local/lib/python2.5/smtplib.py", line 310, in connect
raise socket.error, msg
error: (111, 'Connection refused')
MODULE CACHE DETAILS
Accessed: Tue Oct 16 12:17:36 2007
Instance: 1 [IMPORT]
Modified: Mon Oct 15 11:20:38 2007
Imported: Tue Oct 16 12:17:36 2007
of course, after banging my head on this for long enough to post a question, not 5 minutes later, I've found the solution. The sending mail part was the problem. Don't know why they would put that in their simple example.
Oh well.. If anyone else comes up with this same problem, just comment out the lines that start with "conn"