2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 09:37:10 +00:00

*units in feet and metres, subcaves

This commit is contained in:
Philip Sargent
2020-07-07 01:35:58 +01:00
parent ff3cdb10dc
commit efc43b0863
5 changed files with 85 additions and 44 deletions

View File

@@ -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