Thank you! This works fine, although I need to use form.errors instead of form._errors. The latter does not seem to work in the development version I tried.
- Jan On 22 Aug., 16:47, "Karen Tracey" <[EMAIL PROTECTED]> wrote: > On Fri, Aug 22, 2008 at 7:13 AM, janedenone <[EMAIL PROTECTED]>wrote: > > Hi, > > > I validate my contact form through Django's form validation framework. > > The SMTPSenderRefused exception, however, is not caught in the > > validation process. Now I would like to > > > try: > > send_mail(form.cleaned_data['subject'], > > form.cleaned_data['message'], form.cleaned_data['sender'], > > [recipient], fail_silently=False) > > return render_to_response('thanks.html', { 'current_site' : > > Site.determine_site(request), 'title' : 'Thanks!' }) > > except AttributeError, SMTPSenderRefused: > > # set the invalid error for sender when SMTPSenderRefused > > was raised > > return render_to_response('contact.html', { 'current_site' : > > Site.determine_site(request), 'title' : 'Kontakt', 'form' : form }) > > > The field errors seem to be r/o. Is there a way around this? > > You can add to the _errors dictionary. Some prior discussion with pointers > to examples: > > http://groups.google.com/group/django-users/browse_thread/thread/4dcd... > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---