diff options
Diffstat (limited to 'parsers')
-rw-r--r-- | parsers/imports.py | 6 | ||||
-rw-r--r-- | parsers/subcaves.py | 60 |
2 files changed, 0 insertions, 66 deletions
diff --git a/parsers/imports.py b/parsers/imports.py index 0d5420b..e2a6224 100644 --- a/parsers/imports.py +++ b/parsers/imports.py @@ -6,7 +6,6 @@ from django.core import management from django.db import connection, close_old_connections, connections from django.contrib.auth.models import User from django.http import HttpResponse -#from django.urls import reverse, resolve from django.db import transaction import troggle.settings @@ -15,7 +14,6 @@ import troggle.parsers.people import troggle.parsers.surveys import troggle.parsers.logbooks import troggle.parsers.QMs -import troggle.parsers.subcaves def import_caves(): print("-- Importing Caves to ",end="") @@ -69,8 +67,4 @@ def import_drawingsfiles(): with transaction.atomic(): troggle.parsers.surveys.LoadDrawingFiles() -# Fossil. -# def import_subcaves(): - # print("-- Interpreting SubCaves from CaveDescriptions") - # troggle.parsers.subcaves.importAllSubcaves() diff --git a/parsers/subcaves.py b/parsers/subcaves.py deleted file mode 100644 index 89aa9b6..0000000 --- a/parsers/subcaves.py +++ /dev/null @@ -1,60 +0,0 @@ -# ''' -# This module is the part of troggle that parses descriptions of cave parts (subcaves) from the legacy html files and saves them in the troggle database as instances of the model Subcave. Unfortunately, this parser can not be very flexible because the legacy format is poorly structured. -# ''' -# import sys -# import os -# import re -# import logging - -# from django.conf import settings - -# from troggle.core.models_caves import Cave, NewSubCave -# from utils import save_carefully - -# def getLinksInCaveDescription(cave): - # ''' - # Returns all HTML <a href> tags from a given cave as a list of tuples - # in the format ('filename.html','Description') - # ''' - # pattern='<a href=\"(.*?)\">(.*?)</a>' - # if cave.underground_description: - # return re.findall(pattern,cave.underground_description) - # else: - # return [] - -# def importSubcaves(cave): - # for link in getLinksInCaveDescription(cave): - # try: - # subcaveFilePath=os.path.join( - # settings.EXPOWEB, - # os.path.dirname(cave.description_file), - # link[0]) - # subcaveFile=open(subcaveFilePath,'rb') - # description=subcaveFile.read() # decode('iso-8859-1').encode('utf-8') - - # #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: - # logging.info("Subcave import couldn't open "+subcaveFilePath) - -# def getLinksInSubcaveDescription(subcave): - # pattern='<a href=\"(.*?)\">(.*?)</a>' - # if subcave.description: - # return re.findall(pattern,subcave.description) - # else: - # return [] - -# def getLinksInAllSubcaves(): - # bigList=[] - # for subcave in NewSubCave.objects.all(): - # bigList+=getLinksInSubcaveDescription(subcave) - # return bigList - -# def importAllSubcaves(): - # for cave in Cave.objects.all(): - # importSubcaves(cave) |