mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 05:55:06 +00:00
Updating caves and entrances is no longer nuclear!
Big overhaul of people processing, fullname added to the model lastname is now names -1 unless you only have one (yes you Wookey) this allows for Jon Arne Toft and Wookey to live it the same DB names can now have html chars in them, this should be real unicode but that can only happen when we go to Python 3!
This commit is contained in:
@@ -65,11 +65,27 @@ def LoadPersonsExpos():
|
||||
for personline in personreader:
|
||||
name = personline[header["Name"]]
|
||||
name = re.sub(r"<.*?>", "", name)
|
||||
mname = re.match(r"(\w+)(?:\s((?:van |ten )?\w+))?(?:\s\(([^)]*)\))?", name)
|
||||
nickname = mname.group(3) or ""
|
||||
|
||||
lookupAttribs={'first_name':mname.group(1), 'last_name':(mname.group(2) or "")}
|
||||
nonLookupAttribs={'is_vfho':personline[header["VfHO member"]],}
|
||||
firstname = ""
|
||||
nickname = ""
|
||||
|
||||
rawlastname = personline[header["Lastname"]].strip()
|
||||
matchlastname = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", rawlastname)
|
||||
lastname = matchlastname.group(1).strip()
|
||||
|
||||
splitnick = re.match(r"^([\w&;\s]+)(?:\(([^)]*)\))?", name)
|
||||
fullname = splitnick.group(1)
|
||||
|
||||
nickname = splitnick.group(2) or ""
|
||||
|
||||
fullname = fullname.strip()
|
||||
names = fullname.split(' ')
|
||||
firstname = names[0]
|
||||
if len(names) == 1:
|
||||
lastname = ""
|
||||
|
||||
lookupAttribs={'first_name':firstname, 'last_name':(lastname or "")}
|
||||
nonLookupAttribs={'is_vfho':personline[header["VfHO member"]], 'fullname':fullname}
|
||||
person, created = save_carefully(models.Person, lookupAttribs, nonLookupAttribs)
|
||||
|
||||
parseMugShotAndBlurb(personline=personline, header=header, person=person)
|
||||
@@ -120,14 +136,24 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
possnames = [ ]
|
||||
f = personexpedition.person.first_name.lower()
|
||||
l = personexpedition.person.last_name.lower()
|
||||
full = personexpedition.person.fullname.lower()
|
||||
if l:
|
||||
possnames.append(f + " " + l)
|
||||
possnames.append(f + " " + l[0])
|
||||
possnames.append(f + l[0])
|
||||
possnames.append(f[0] + " " + l)
|
||||
possnames.append(f)
|
||||
if personexpedition.nickname:
|
||||
if full not in possnames:
|
||||
possnames.append(full)
|
||||
if personexpedition.nickname not in possnames:
|
||||
possnames.append(personexpedition.nickname.lower())
|
||||
if l:
|
||||
# This allows for nickname to be used for short name eg Phil
|
||||
# adding Phil Sargent to the list
|
||||
if str(personexpedition.nickname.lower() + " " + l) not in possnames:
|
||||
possnames.append(personexpedition.nickname.lower() + " " + l)
|
||||
if str(personexpedition.nickname.lower() + " " + l[0]) not in possnames:
|
||||
possnames.append(personexpedition.nickname.lower() + " " + l[0])
|
||||
|
||||
for possname in possnames:
|
||||
if possname in res:
|
||||
|
||||
Reference in New Issue
Block a user