From 60735a9b3acae9d883589c51aa953ced40cc7488 Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Wed, 13 May 2009 05:43:20 +0100 Subject: [svn] merge the trip table to have surveys by date Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8221 by julian @ 1/24/2009 2:01 PM --- parsers/logbooks.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'parsers/logbooks.py') diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 3de28d7..9ad1962 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -4,6 +4,7 @@ import troggle.settings as settings import troggle.expo.models as models from troggle.parsers.people import GetPersonExpeditionNameLookup +from troggle.parsers.cavetab import GetCaveLookup import csv import re @@ -64,13 +65,14 @@ def GetTripCave(place): #need to be fuzzier about matching h def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_underground): trippersons, author = GetTripPersons(trippeople, expedition, logtime_underground) - tripCave = GetTripCave(place) +# tripCave = GetTripCave(place) lbo = models.LogbookEntry(date=date, place=place, title=title[:50], text=text, author=author, expedition=expedition) - if tripCave: - lbo.cave=tripCave + lbo.cave=GetCaveLookup().get(place) + print "pppp", place, lbo.cave + lbo.save() - print "ttt", date, place + #print "ttt", date, place for tripperson, time_underground in trippersons: pto = models.PersonTrip(person_expedition = tripperson, place=place, date=date, time_underground=time_underground, logbook_entry=lbo, is_logbook_entry_author=(tripperson == author)) @@ -156,7 +158,7 @@ def Parseloghtml01(year, expedition, txt): tripid = mtripid and mtripid.group(1) or "" tripheader = re.sub("]*>", "", tripheader) - #print [tripheader] + print [tripheader] #continue tripdate, triptitle, trippeople = tripheader.split("|") @@ -234,7 +236,7 @@ yearlinks = [ ("1999", "1999/log.htm", Parseloghtml01), ("1998", "1998/log.htm", Parseloghtml01), ("1997", "1997/log.htm", Parseloghtml01), - #("1996", "1996/log.htm", Parseloghtml01), + ("1996", "1996/log.htm", Parseloghtml01), ] def SetDatesFromLogbookEntries(expedition): @@ -303,7 +305,7 @@ def LoadLogbooks(): models.LogbookEntry.objects.all().delete() expowebbase = os.path.join(settings.EXPOWEB, "years") #yearlinks = [ ("2001", "2001/log.htm", Parseloghtml01), ] #overwrite - #yearlinks = [ ("1997", "1997/log.htm", Parseloghtml01),] # overwrite + #yearlinks = [ ("1996", "1996/log.htm", Parseloghtml01),] # overwrite for year, lloc, parsefunc in yearlinks: expedition = models.Expedition.objects.filter(year = year)[0] -- cgit v1.2.3