diff options
Diffstat (limited to 'parsers/drawings.py')
-rw-r--r-- | parsers/drawings.py | 8 |
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): |