BUGFIX: Capture invalid email exceptions and ignore those inputs.

This commit is contained in:
Bruno Tikami 2016-03-15 14:13:19 -03:00
parent 4124677f10
commit 99ae4bb801
2 changed files with 7 additions and 3 deletions

View File

@ -562,7 +562,7 @@ class TicketCCForm(forms.ModelForm):
email = cleaned_data.get('email', '')
if user is None and len(email) == 0:
raise forms.ValidationError(_('When you add somebody on Cc, you must provided either an User or a valid email.'))
raise forms.ValidationError(_('When you add somebody on Cc, you must provided either an User or a valid email. Email: %s' %email))
class TicketDependencyForm(forms.ModelForm):
class Meta:

View File

@ -24,6 +24,7 @@ from optparse import make_option
from email_reply_parser import EmailReplyParser
from django.core.exceptions import ValidationError
from django.core.files.base import ContentFile
from django.core.management.base import BaseCommand
from django.db.models import Q
@ -183,8 +184,11 @@ def create_ticket_cc(ticket, cc_list):
except User.DoesNotExist:
pass
try:
ticket_cc = subscribe_to_ticket_updates(ticket=ticket, user=user, email=cced_email)
new_ticket_ccs.append(ticket_cc)
except ValidationError, err:
pass
return new_ticket_ccs