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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user