diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2020-07-07 01:35:58 +0100 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2020-07-07 01:35:58 +0100 |
commit | efc43b0863bf38cdae3b1a6141f6b5a3f5e6a8e0 (patch) | |
tree | 52c5a0db72faaf6254e333b0fbf5d3ca6fce43a8 /parsers/subcaves.py | |
parent | ff3cdb10dce41bf890865e8f749a43c20d02cfd0 (diff) | |
download | troggle-efc43b0863bf38cdae3b1a6141f6b5a3f5e6a8e0.tar.gz troggle-efc43b0863bf38cdae3b1a6141f6b5a3f5e6a8e0.tar.bz2 troggle-efc43b0863bf38cdae3b1a6141f6b5a3f5e6a8e0.zip |
*units in feet and metres, subcaves
Diffstat (limited to 'parsers/subcaves.py')
-rw-r--r-- | parsers/subcaves.py | 16 |
1 files changed, 9 insertions, 7 deletions
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 |