2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 06:47:07 +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

@@ -18,9 +18,13 @@ from troggle.core.utils import save_carefully
for tunnel and therion files
'''
todo='''Rename functions more consistently between tunnel and therion variants
todo='''- Rename functions more consistently between tunnel and therion variants
- Recode rx_valid_ext to use profile suffix() function
'''
rx_valid_ext = re.compile(r'(?i)\.(?:png|jpg|pdf|jpeg|gif|txt)$')
def find_dwg_file(dwgfile, path):
'''Is given a line of text 'path' which may or may not contain a recognisable name of a scanned file
which we have already seen when we imported all the files we could find in the surveyscans direstories
@@ -54,7 +58,7 @@ def find_dwg_file(dwgfile, path):
if scansfile:
dwgfile.scans.add(scansfile)
elif path and not re.search(r"\.(?:png|jpg|pdf|jpeg|gif|txt)$(?i)", path):
elif path and not rx_valid_ext.search(path):
name = os.path.split(path)[1]
rdwgfilel = DrawingFile.objects.filter(dwgname=name)
if len(rdwgfilel):