mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 05:55:06 +00:00
Convert codebase for python3 usage
This commit is contained in:
@@ -4,7 +4,7 @@ from django.conf import settings
|
||||
import troggle.core.models as models
|
||||
import csv, re, datetime, os, shutil
|
||||
from utils import save_carefully
|
||||
from HTMLParser import HTMLParser
|
||||
from html.parser import HTMLParser
|
||||
from unidecode import unidecode
|
||||
|
||||
# def saveMugShot(mugShotPath, mugShotFilename, person):
|
||||
@@ -45,7 +45,7 @@ def parseMugShotAndBlurb(personline, header, person):
|
||||
#Only finds the first image, not all of them
|
||||
person.blurb=re.search('<body>.*<hr',personPageOld,re.DOTALL).group()
|
||||
else:
|
||||
print "ERROR: --------------- Broken link or Blurb parse error in ", mugShotFilename
|
||||
print("ERROR: --------------- Broken link or Blurb parse error in ", mugShotFilename)
|
||||
#for mugShotFilename in re.findall('i/.*?jpg',personPageOld,re.DOTALL):
|
||||
# mugShotPath = os.path.join(settings.EXPOWEB, "folk", mugShotFilename)
|
||||
# saveMugShot(mugShotPath=mugShotPath, mugShotFilename=mugShotFilename, person=person)
|
||||
@@ -55,8 +55,8 @@ 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))))
|
||||
headers = next(personreader)
|
||||
header = dict(list(zip(headers, list(range(len(headers))))))
|
||||
|
||||
# make expeditions
|
||||
print(" - Loading expeditions")
|
||||
@@ -100,7 +100,7 @@ def LoadPersonsExpos():
|
||||
parseMugShotAndBlurb(personline=personline, header=header, person=person)
|
||||
|
||||
# make person expedition from table
|
||||
for year, attended in zip(headers, personline)[5:]:
|
||||
for year, attended in list(zip(headers, personline))[5:]:
|
||||
expedition = models.Expedition.objects.get(year=year)
|
||||
if attended == "1" or attended == "-1":
|
||||
lookupAttribs = {'person':person, 'expedition':expedition}
|
||||
|
||||
Reference in New Issue
Block a user