From 9961c31e735f8a7568c6cde8e3644cb9e3c768e5 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 19 Jan 2015 21:28:35 +0000 Subject: [PATCH 1/7] Try and ignore files that don't end .html (We really need to change to .xml) eg .html.orig!! Change the index on troggle to move on with the year --- parsers/caves.py | 3 ++- templates/base.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/parsers/caves.py b/parsers/caves.py index d4d53cd..5c4ceb5 100644 --- a/parsers/caves.py +++ b/parsers/caves.py @@ -13,7 +13,8 @@ def readcaves(): print "Reading Entrances" #print "list of " for filename in os.walk(settings.ENTRANCEDESCRIPTIONS).next()[2]: #Should be a better way of getting a list of files - readentrance(filename) + if filename.endswith('.html'): + readentrance(filename) print "Reading Caves" for filename in os.walk(settings.CAVEDESCRIPTIONS).next()[2]: #Should be a better way of getting a list of files readcave(filename) diff --git a/templates/base.html b/templates/base.html index fda3617..76e34fa 100644 --- a/templates/base.html +++ b/templates/base.html @@ -38,9 +38,9 @@ 161 | 204 | 258 | - Expo2011 | Expo2012 | Expo2013 | + Expo2014 | Django admin From 0ab32ef60a26c096f19cf6236b1fca64216f7316 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 19 Jan 2015 22:41:48 +0000 Subject: [PATCH 2/7] Add a little verbosity --- parsers/surveys.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parsers/surveys.py b/parsers/surveys.py index fc5b865..0ce86a0 100644 --- a/parsers/surveys.py +++ b/parsers/surveys.py @@ -189,6 +189,9 @@ def LoadListScansFile(survexscansfolder): # this iterates through the scans directories (either here or on the remote server) # and builds up the models we can access later def LoadListScans(): + + print '\tLoading Survey Scans...' + SurvexScanSingle.objects.all().delete() SurvexScansFolder.objects.all().delete() From 3bdd1ad7376a7e8bf933526b2ccaf7fe2acfd822 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 19 Jan 2015 22:48:50 +0000 Subject: [PATCH 3/7] A little more verbosity --- parsers/survex.py | 6 ++++++ parsers/surveys.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/parsers/survex.py b/parsers/survex.py index 1450255..035c21e 100644 --- a/parsers/survex.py +++ b/parsers/survex.py @@ -231,6 +231,9 @@ def ReloadSurvexCave(survex_cave): def LoadAllSurvexBlocks(): + + print 'Loading All Survex Blocks...' + models.SurvexBlock.objects.all().delete() models.SurvexFile.objects.all().delete() models.SurvexDirectory.objects.all().delete() @@ -265,6 +268,9 @@ def LoadAllSurvexBlocks(): poslineregex = re.compile("^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$") def LoadPos(): + + print 'Loading Pos....' + call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA]) call([settings.THREEDTOPOS, '%sall.3d' % settings.SURVEX_DATA], cwd = settings.SURVEX_DATA) posfile = open("%sall.pos" % settings.SURVEX_DATA) diff --git a/parsers/surveys.py b/parsers/surveys.py index 0ce86a0..07e8cc2 100644 --- a/parsers/surveys.py +++ b/parsers/surveys.py @@ -190,8 +190,8 @@ def LoadListScansFile(survexscansfolder): # and builds up the models we can access later def LoadListScans(): - print '\tLoading Survey Scans...' - + print 'Loading Survey Scans...' + SurvexScanSingle.objects.all().delete() SurvexScansFolder.objects.all().delete() From a5e7fcf43534facb47ea07706fddc68264363921 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 26 Jan 2015 21:12:27 +0000 Subject: [PATCH 4/7] Don't assert an error on bad date formats --- parsers/logbooks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 4180345..cf0ad96 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -112,7 +112,8 @@ def ParseDate(tripdate, year): yadd = int(year[:2]) * 100 day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd else: - assert False, tripdate + continue + #assert False, tripdate return datetime.date(year, month, day) # 2007, 2008, 2006 From 187e537f460c2a94f6fa27c32da5b2d490c48ea9 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 26 Jan 2015 21:13:47 +0000 Subject: [PATCH 5/7] Ooops that wasn't right --- parsers/logbooks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index cf0ad96..c4e05e6 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -112,7 +112,6 @@ def ParseDate(tripdate, year): yadd = int(year[:2]) * 100 day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd else: - continue #assert False, tripdate return datetime.date(year, month, day) From 086bfe61a1d13e5499d7c73908ce6a869d667f3a Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 26 Jan 2015 21:15:17 +0000 Subject: [PATCH 6/7] One more try --- parsers/logbooks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index c4e05e6..1c8db99 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -111,7 +111,6 @@ def ParseDate(tripdate, year): assert not mdategoof.group(3) or mdategoof.group(3) == year[:2], mdategoof.groups() yadd = int(year[:2]) * 100 day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd - else: #assert False, tripdate return datetime.date(year, month, day) From 244a6177cf88b8a88a35cd3b6b90da742dc3e4c0 Mon Sep 17 00:00:00 2001 From: Sam Wenham Date: Mon, 26 Jan 2015 21:53:32 +0000 Subject: [PATCH 7/7] Revert all of this the date is needed and is a not null in the db --- parsers/logbooks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 1c8db99..4180345 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -111,7 +111,8 @@ def ParseDate(tripdate, year): assert not mdategoof.group(3) or mdategoof.group(3) == year[:2], mdategoof.groups() yadd = int(year[:2]) * 100 day, month, year = int(mdategoof.group(1)), int(mdategoof.group(2)), int(mdategoof.group(4)) + yadd - #assert False, tripdate + else: + assert False, tripdate return datetime.date(year, month, day) # 2007, 2008, 2006