2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 21:07:12 +00:00

make compatible with python 3.11 as well as 3.10

This commit is contained in:
Philip Sargent
2022-11-18 20:42:03 +00:00
parent 725c5ad0cd
commit 4514eda311
3 changed files with 15 additions and 5 deletions

View File

@@ -81,20 +81,23 @@ def set_trip_id(year, seq):
tid= f"{year}_s{seq:02d}"
return tid
rx_tripperson = re.compile(r'(?i)<u>(.*?)</u>$')
rx_round_bracket = re.compile(r"[\(\[].*?[\)\]]")
def GetTripPersons(trippeople, expedition, logtime_underground, tid=None):
res = [ ]
author = None
round_bracket_regex = re.compile(r"[\(\[].*?[\)\]]")
#print(f'# {tid}')
for tripperson in re.split(r",|\+|&amp;|&(?!\w+;)| and ", trippeople):
tripperson = tripperson.strip()
mul = re.match(r"<u>(.*?)</u>$(?i)", tripperson)
# mul = re.match(r"(?i)<u>(.*?)</u>$", tripperson)
mul = rx_tripperson.match(tripperson)
if mul:
tripperson = mul.group(1).strip()
if tripperson and tripperson[0] != '*':
tripperson = re.sub(round_bracket_regex, "", tripperson).strip()
tripperson = re.sub(rx_round_bracket, "", tripperson).strip()
if tripperson =="Wiggy":
tripperson = "Phil Wigglesworth"
@@ -134,6 +137,7 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
DataIssue.objects.create(parser='logbooks', message=message)
logdataissues["title"]=message
print(message)
raise
return
if not author: