Skip to content

Commit b41aef6

Browse files
committed
Fix registration import, use user.person if it exists. Commit ready for merge
- Legacy-Id: 16359
1 parent e101d94 commit b41aef6

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

ietf/stats/utils.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Copyright The IETF Trust 2009-2019, All Rights Reserved
2+
# -*- coding: utf-8 -*-
3+
14
import re
25
import requests
36
from collections import defaultdict
@@ -289,15 +292,23 @@ def get_meeting_registration_data(meeting):
289292
)
290293

291294
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-
)
295+
try:
296+
if user.person:
297+
person = user.person
298+
else:
299+
person = None
300+
except Person.DoesNotExist:
301+
person = None
302+
if person is None:
303+
if aliases.exists():
304+
person = aliases.first().person
305+
else:
306+
# Create the new Person object.
307+
person = Person.objects.create(
308+
name=regname,
309+
ascii=ascii_name,
310+
user=user,
311+
)
301312

302313
# Create an associated Email address for this Person
303314
try:

0 commit comments

Comments
 (0)