summaryrefslogtreecommitdiffstats
path: root/parsers/drawings.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2022-11-18 20:42:03 +0000
committerPhilip Sargent <philip.sargent@klebos.com>2022-11-18 20:42:03 +0000
commit4514eda311451aefd684c587300774501ef20afb (patch)
treee69f86d549e887c8ce500de57517b86e2bf33e91 /parsers/drawings.py
parent725c5ad0cde2dc610781ab033c723f8de9e996b7 (diff)
downloadtroggle-4514eda311451aefd684c587300774501ef20afb.tar.gz
troggle-4514eda311451aefd684c587300774501ef20afb.tar.bz2
troggle-4514eda311451aefd684c587300774501ef20afb.zip
make compatible with python 3.11 as well as 3.10
Diffstat (limited to 'parsers/drawings.py')
-rw-r--r--parsers/drawings.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/parsers/drawings.py b/parsers/drawings.py
index b3ce8c8..1ef03a9 100644
--- a/parsers/drawings.py
+++ b/parsers/drawings.py
@@ -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):