From 43dfe946b6385037141b94b775112037fe5f032f Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 24 Feb 2020 15:04:07 +0000 Subject: Just removing dud whitespace --- parsers/people.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'parsers/people.py') diff --git a/parsers/people.py b/parsers/people.py index 28a036a..0d253c9 100644 --- a/parsers/people.py +++ b/parsers/people.py @@ -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 -- cgit v1.2.3