Hello,

While I was following the chapter 7 (Form processing) of the django
book, I got the following error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/handlers/base.py" in get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "/Users/yjlee/Documents/Worx/Django/DjangoWorx/mysite2/../mysite2/
books/views.py" in contact
  30. message, sender, ['[EMAIL PROTECTED]'])
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/mail.py" in send_mail
  49. return send_mass_mail([[subject, message, from_email,
recipient_list]], fail_silently, auth_user, auth_password)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages/django/core/mail.py" in send_mass_mail
  66. server = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
smtplib.py" in __init__
  244. (code, msg) = self.connect(host, port)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
smtplib.py" in connect
  310. raise socket.error, msg

  error at /contact/
  (49, "Can't assign requested address")

It seems that this error was coming from HttpResponseRedirect() of the
contact view method, but I did not figure what went wrong. This is my
"contact" view method:
def contact(request):
        if request.method == 'POST':
                form = ContactForm(request.POST)
                if form.is_valid():
                        topic = form.clean_data['topic']
                        message = form.clean_data['message']
                        sender = form.clean_data.get('sender', '[EMAIL 
PROTECTED]')
                        send_mail('Feedback from your site, topic: %s' % topic,
                                message, sender, ['[EMAIL PROTECTED]'])
                        return HttpResponseRedirect('/contact/thanks/')
        else:
                form = ContactForm()
        return render_to_response('books/contact.html', {'form': form})

One odd thing is that I got the same error (cannot assign requested
address) even if I tried to redirect HttpResponse to "http://
www.google.com".

Can anyone explain how to resolve this problem?

Thanks in advance,

YJ

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to