mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 15:47:10 +00:00
make more robust against data error
This commit is contained in:
@@ -137,10 +137,15 @@ def load_people_expos():
|
||||
nick = ""
|
||||
|
||||
rawlastname = personline[header["Lastname"]].strip()
|
||||
matchlastname = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", rawlastname)
|
||||
lastname = matchlastname.group(1).strip()
|
||||
if rawlastname == "":
|
||||
print(f"MISSING SURNAME FIELD for {name} - check against similar names in the list to see what you have done.")
|
||||
if matchlastname := re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", rawlastname):
|
||||
lastname = matchlastname.group(1).strip()
|
||||
else:
|
||||
print(f"MATCH FAIL {personline=}\n {slug=}\n {name=}\n {rawlastname=}")
|
||||
exit(1)
|
||||
|
||||
splitnick = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", plainname)
|
||||
splitnick = re.match(r"^([\w&;\s\-]+)(?:\(([^)]*)\))?", plainname)
|
||||
fullname = splitnick.group(1) # removes Nickname in brackets, but also cuts hyphenated names
|
||||
nick = splitnick.group(2) or ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user