diff options
Diffstat (limited to 'parsers')
-rw-r--r-- | parsers/QMs.py | 4 | ||||
-rw-r--r-- | parsers/logbooks.py | 3 | ||||
-rw-r--r-- | parsers/people.py | 10 | ||||
-rw-r--r-- | parsers/surveys.py | 2 |
4 files changed, 10 insertions, 9 deletions
diff --git a/parsers/QMs.py b/parsers/QMs.py index a95a3cd..7449a8a 100644 --- a/parsers/QMs.py +++ b/parsers/QMs.py @@ -7,7 +7,7 @@ from django.conf import settings from troggle.core.models import DataIssue from troggle.core.models_caves import QM, Cave, LogbookEntry -from utils import save_carefully +from troggle.core.utils import save_carefully def deleteQMs(): @@ -110,7 +110,7 @@ def parse_KH_QMs(kh, inputFile): khQMs=open(os.path.join(settings.EXPOWEB, inputFile),'r') khQMs=khQMs.readlines() for line in khQMs: - res=re.search('name=\"[CB](?P<year>\d*)-(?P<cave>\d*)-(?P<number>\d*).*</a> (?P<grade>[ABDCV])<dd>(?P<description>.*)\[(?P<nearest_station>.*)\]',line) + res=re.search(r'name=\"[CB](?P<year>\d*)-(?P<cave>\d*)-(?P<number>\d*).*</a> (?P<grade>[ABDCV])<dd>(?P<description>.*)\[(?P<nearest_station>.*)\]',line) if res: res=res.groupdict() year=int(res['year']) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 00c8b14..7a334d6 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -11,10 +11,9 @@ from django.template.defaultfilters import slugify from django.utils.timezone import get_current_timezone, make_aware from troggle.core.models import DataIssue, Expedition -from troggle.core.utils import TROG +from troggle.core.utils import TROG, save_carefully from troggle.core.models_caves import Cave, LogbookEntry, PersonTrip, GetCaveLookup from parsers.people import GetPersonExpeditionNameLookup -from utils import save_carefully # # When we edit logbook entries, allow a "?" after any piece of data to say we've frigged it and diff --git a/parsers/people.py b/parsers/people.py index bd67e8a..ecc9272 100644 --- a/parsers/people.py +++ b/parsers/people.py @@ -1,11 +1,13 @@ -from django.conf import settings -import troggle.core.models as models import csv, re, datetime, os, shutil -from utils import save_carefully from html.parser import HTMLParser from unidecode import unidecode -'''These functions do not match how the stand-alone script works. So the script produces an HTML file which has +from django.conf import settings + +import troggle.core.models as models +from troggle.core.utils import save_carefully + +'''These functions do not match how the stand-alone folk script works. So the script produces an HTML file which has href links to pages in troggle which troggle does not think are right. The standalone script needs to be renedred defucnt, and all the parsing needs to be in troggle. Either that, or they should use the same code by importing a module. diff --git a/parsers/surveys.py b/parsers/surveys.py index 40a12f0..3207194 100644 --- a/parsers/surveys.py +++ b/parsers/surveys.py @@ -8,12 +8,12 @@ import re import datetime from PIL import Image -from utils import save_carefully from functools import reduce import settings from troggle.core.models_survex import SingleScan, ScansFolder, TunnelFile from troggle.core.models import DataIssue +from troggle.core.utils import save_carefully def get_or_create_placeholder(year): |