mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 08:27:13 +00:00
Just removing dud whitespace
This commit is contained in:
@@ -12,22 +12,22 @@ def saveMugShot(mugShotPath, mugShotFilename, person):
|
||||
mugShotFilename=mugShotFilename[2:]
|
||||
else:
|
||||
mugShotFilename=mugShotFilename # just in case one doesn't
|
||||
|
||||
|
||||
dummyObj=models.DPhoto(file=mugShotFilename)
|
||||
|
||||
|
||||
#Put a copy of the file in the right place. mugShotObj.file.path is determined by the django filesystemstorage specified in models.py
|
||||
if not os.path.exists(dummyObj.file.path):
|
||||
shutil.copy(mugShotPath, dummyObj.file.path)
|
||||
|
||||
|
||||
mugShotObj, created = save_carefully(
|
||||
models.DPhoto,
|
||||
lookupAttribs={'is_mugshot':True, 'file':mugShotFilename},
|
||||
nonLookupAttribs={'caption':"Mugshot for "+person.first_name+" "+person.last_name}
|
||||
)
|
||||
|
||||
|
||||
if created:
|
||||
mugShotObj.contains_person.add(person)
|
||||
mugShotObj.save()
|
||||
mugShotObj.save()
|
||||
|
||||
def parseMugShotAndBlurb(personline, header, person):
|
||||
"""create mugshot Photo instance"""
|
||||
@@ -45,20 +45,20 @@ def parseMugShotAndBlurb(personline, header, person):
|
||||
person.save()
|
||||
|
||||
def LoadPersonsExpos():
|
||||
|
||||
|
||||
persontab = open(os.path.join(settings.EXPOWEB, "folk", "folk.csv"))
|
||||
personreader = csv.reader(persontab)
|
||||
headers = personreader.next()
|
||||
header = dict(zip(headers, range(len(headers))))
|
||||
|
||||
|
||||
# make expeditions
|
||||
print("Loading expeditions")
|
||||
years = headers[5:]
|
||||
|
||||
|
||||
for year in years:
|
||||
lookupAttribs = {'year':year}
|
||||
nonLookupAttribs = {'name':"CUCC expo %s" % year}
|
||||
|
||||
|
||||
save_carefully(models.Expedition, lookupAttribs, nonLookupAttribs)
|
||||
|
||||
# make persons
|
||||
@@ -91,7 +91,7 @@ def LoadPersonsExpos():
|
||||
person, created = save_carefully(models.Person, lookupAttribs, nonLookupAttribs)
|
||||
|
||||
parseMugShotAndBlurb(personline=personline, header=header, person=person)
|
||||
|
||||
|
||||
# make person expedition from table
|
||||
for year, attended in zip(headers, personline)[5:]:
|
||||
expedition = models.Expedition.objects.get(year=year)
|
||||
@@ -108,10 +108,10 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
res = Gpersonexpeditionnamelookup.get(expedition.name)
|
||||
if res:
|
||||
return res
|
||||
|
||||
|
||||
res = { }
|
||||
duplicates = set()
|
||||
|
||||
|
||||
print("Calculating GetPersonExpeditionNameLookup for " + expedition.year)
|
||||
personexpeditions = models.PersonExpedition.objects.filter(expedition=expedition)
|
||||
htmlparser = HTMLParser()
|
||||
@@ -139,16 +139,16 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
possnames.append(personexpedition.nickname.lower() + " " + l[0])
|
||||
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:
|
||||
duplicates.add(possname)
|
||||
else:
|
||||
res[possname] = personexpedition
|
||||
|
||||
|
||||
for possname in duplicates:
|
||||
del res[possname]
|
||||
|
||||
|
||||
Gpersonexpeditionnamelookup[expedition.name] = res
|
||||
return res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user