Made some changes to the missing-email submission handling. This may have fixed the creation of author records containing 'none' email entries, but as I've not been able to reproduce the issue, this is uncertain. Next is to build an email notification assert statement to help capture information if this happens.
- Legacy-Id: 12898
This commit is contained in:
parent
27351c4349
commit
a5290e143a
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import datetime
|
import datetime
|
||||||
|
from unidecode import unidecode
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
|
@ -19,7 +20,6 @@ from ietf.person.models import Person, Email
|
||||||
from ietf.community.utils import update_name_contains_indexes_with_new_doc
|
from ietf.community.utils import update_name_contains_indexes_with_new_doc
|
||||||
from ietf.submit.mail import announce_to_lists, announce_new_version, announce_to_authors
|
from ietf.submit.mail import announce_to_lists, announce_new_version, announce_to_authors
|
||||||
from ietf.submit.models import Submission, SubmissionEvent, Preapproval, DraftSubmissionStateName
|
from ietf.submit.models import Submission, SubmissionEvent, Preapproval, DraftSubmissionStateName
|
||||||
from ietf.utils import unaccent
|
|
||||||
from ietf.utils.log import log
|
from ietf.utils.log import log
|
||||||
|
|
||||||
|
|
||||||
|
@ -387,23 +387,25 @@ def get_person_from_name_email(name, email):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def ensure_person_email_info_exists(name, email):
|
def ensure_person_email_info_exists(name, email):
|
||||||
person = get_person_from_name_email(name, email)
|
addr = email
|
||||||
|
email = None
|
||||||
|
person = get_person_from_name_email(name, addr)
|
||||||
|
|
||||||
# make sure we have a person
|
# make sure we have a person
|
||||||
if not person:
|
if not person:
|
||||||
person = Person()
|
person = Person()
|
||||||
person.name = name
|
person.name = name
|
||||||
person.ascii = unaccent.asciify(person.name)
|
person.ascii = unidecode(person.name)
|
||||||
person.save()
|
person.save()
|
||||||
|
|
||||||
# make sure we have an email address
|
# make sure we have an email address
|
||||||
if email:
|
if addr:
|
||||||
active = True
|
active = True
|
||||||
addr = email.lower()
|
addr = addr.lower()
|
||||||
else:
|
else:
|
||||||
# we're in trouble, use a fake one
|
# we're in trouble, use a fake one
|
||||||
active = False
|
active = False
|
||||||
addr = u"unknown-email-%s" % person.plain_name().replace(" ", "-")
|
addr = u"unknown-email-%s" % person.plain_ascii().replace(" ", "-")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
email = person.email_set.get(address=addr)
|
email = person.email_set.get(address=addr)
|
||||||
|
|
Loading…
Reference in a new issue