diff options
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 |