Skip to content

Commit a70c6d4

Browse files
committed
A fix for an issue in get_meeting_registration_data() which could happen if we tried to create a Person record for with a user of an existing Person.
- Legacy-Id: 16331
1 parent a50e3dd commit a70c6d4

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

ietf/stats/utils.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright The IETF Trust 2017-2019, All Rights Reserved
2+
# -*- coding: utf-8 -*-
3+
14
import re
25
import requests
36
from collections import defaultdict
@@ -288,16 +291,19 @@ def get_meeting_registration_data(meeting):
288291
email=address,
289292
)
290293

291-
aliases = Alias.objects.filter(name=regname)
292-
if aliases.exists():
293-
person = aliases.first().person
294-
else:
295-
# Create the new Person object.
296-
person = Person.objects.create(
297-
name=regname,
298-
ascii=ascii_name,
299-
user=user,
300-
)
294+
try:
295+
person = user.person
296+
except Person.DoesNotExist:
297+
aliases = Alias.objects.filter(name=regname)
298+
if aliases.exists():
299+
person = aliases.first().person
300+
else:
301+
# Create the new Person object.
302+
person = Person.objects.create(
303+
name=regname,
304+
ascii=ascii_name,
305+
user=user,
306+
)
301307

302308
# Create an associated Email address for this Person
303309
try:

0 commit comments

Comments
 (0)