On Tue, Jul 7, 2009 at 2:45 AM, alecs <alecs....@gmail.com> wrote:

>
> I'm trying to send a e-mail, but getting this error. Don't know what
> to do... Any ideas?
> Thanks in advance.
>
> def urlsend(request, username):
>    if request.method == 'POST':
>        form = SendMailForm(request.POST)
>        if form.is_valid():
>            subject = form.cleaned_data['subject']
>            message = form.cleaned_data['message']
>            to_email = form.cleaned_data['to_email']
>            try:
>                send_mail(subject, message, 'u...@exmpl.com',
> to_email, fail_silently = False,
>                    auth_user = 'u...@exmpl.com', auth_password =
> 'pass')
>            except Exception, e:
>                raise ValueError,e


Why are you doing this with catching an Exception and raising a ValueError
instead?  In doing so you lose in the traceback the information about where
the error really originated, since the traceback ends at your "raise
ValueError, e", instead of ending at whatever code is actually trying to
access the 'user' attribute of a unicode object.  Get rid of this
try/except/raise and the traceback will actually reflect where the problem
is.

Also, when you post tracebacks, please click the 'Switch to copy-and-paste
view' link before copying the data.  The full page is useful when seen in a
broswer but the loss of formatting when pasted makes it virtually unusable.

Karen

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

Reply via email to