From 23df89cf319f05cbad4cb769c05c5699fe9d3f4a Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Sun, 14 Apr 2019 22:45:31 +0100 Subject: Fix CSRF issues in svx form Set date formats Add DataIssue model and add errors to it to allow us to give people a list of stuff to fix --- parsers/logbooks.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'parsers/logbooks.py') diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 2d1875a..bf6081f 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -7,6 +7,8 @@ from parsers.people import GetPersonExpeditionNameLookup from parsers.cavetab import GetCaveLookup from django.template.defaultfilters import slugify +from django.utils.timezone import get_current_timezone +from django.utils.timezone import make_aware import csv import re @@ -36,6 +38,8 @@ def GetTripPersons(trippeople, expedition, logtime_underground): personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower()) if not personyear: print(" - No name match for: '%s'" % tripperson) + message = "No name match for: '%s' in year '%s'" % (tripperson, expedition.year) + models.DataIssue.objects.create(parser='logbooks', message=message) res.append((personyear, logtime_underground)) if mul: author = personyear @@ -79,6 +83,8 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_ trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground) if not author: print(" - Skipping logentry: " + title + " - no author for entry") + message = "Skipping logentry: %s - no author for entry in year '%s'" % (title, expedition.year) + models.DataIssue.objects.create(parser='logbooks', message=message) return #tripCave = GetTripCave(place) -- cgit v1.2.3