From efc43b0863bf38cdae3b1a6141f6b5a3f5e6a8e0 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Tue, 7 Jul 2020 01:35:58 +0100 Subject: *units in feet and metres, subcaves --- parsers/subcaves.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'parsers/subcaves.py') diff --git a/parsers/subcaves.py b/parsers/subcaves.py index 0762007..ef1a0c2 100644 --- a/parsers/subcaves.py +++ b/parsers/subcaves.py @@ -8,7 +8,7 @@ import logging from django.conf import settings -from troggle.core.models import Subcave, Cave +from troggle.core.models_caves import Cave, NewSubCave from utils import save_carefully def getLinksInCaveDescription(cave): @@ -29,12 +29,14 @@ def importSubcaves(cave): settings.EXPOWEB, os.path.dirname(cave.description_file), link[0]) - subcaveFile=open(subcaveFilePath,'r') - description=subcaveFile.read().decode('iso-8859-1').encode('utf-8') + subcaveFile=open(subcaveFilePath,'rb') + description=subcaveFile.read() # decode('iso-8859-1').encode('utf-8') - lookupAttribs={'title':link[1], 'cave':cave} - nonLookupAttribs={'description':description} - newSubcave=save_carefully(Subcave,lookupAttribs=lookupAttribs,nonLookupAttribs=nonLookupAttribs) + #lookupAttribs={'title':link[1], 'cave':cave} + #nonLookupAttribs={'description':description} + lookupAttribs={} + nonLookupAttribs={} + newSubcave=save_carefully(NewSubCave,lookupAttribs=lookupAttribs,nonLookupAttribs=nonLookupAttribs) logging.info("Added " + str(newSubcave) + " to " + str(cave)) except IOError: @@ -49,7 +51,7 @@ def getLinksInSubcaveDescription(subcave): def getLinksInAllSubcaves(): bigList=[] - for subcave in Subcave.objects.all(): + for subcave in NewSubCave.objects.all(): bigList+=getLinksInSubcaveDescription(subcave) return bigList -- cgit v1.2.3