diff --git a/flatpages/views.py b/flatpages/views.py index 11cb457..e9db223 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -84,6 +84,8 @@ def getmimetype(path): if path.endswith(".3d"): return "application/x-survex-3d" if path.endswith(".pos"): return "application/x-survex-pos" if path.endswith(".err"): return "application/x-survex-err" + if path.endswith(".odt"): return "application/vnd.oasis.opendocument.text" + if path.endswith(".ods"): return "application/vnd.oasis.opendocument.spreadsheet" return "" @login_required_if_public diff --git a/parsers/cavetab.py b/parsers/cavetab.py index d76a280..e133ca8 100644 --- a/parsers/cavetab.py +++ b/parsers/cavetab.py @@ -55,7 +55,7 @@ Findability = 44 FindabilityComment = 45 def LoadCaveTab(): - + cavetab = open(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV"),'rU') caveReader = csv.reader(cavetab) caveReader.next() # Strip out column headers @@ -69,7 +69,7 @@ def LoadCaveTab(): logging.info("Added area "+str(newArea.short_name)+"\n") area1626 = models.Area.objects.filter(short_name = '1626')[0] area1623 = models.Area.objects.filter(short_name = '1623')[0] - + counter=0 for line in caveReader : if line[Area] == 'nonexistent': @@ -82,11 +82,11 @@ def LoadCaveTab(): def addToArgs(CSVname, modelName): if line[CSVname]: args[modelName] = line[CSVname] - + def addToDefaultArgs(CSVname, modelName): #This has to do with the non-destructive import. These arguments will be passed as the "default" dictionary in a get_or_create if line[CSVname]: defaultArgs[modelName] = line[CSVname] - + # The attributes added using "addToArgs" will be used to look up an existing cave. Those added using "addToDefaultArgs" will not. addToArgs(KatasterNumber, "kataster_number") addToDefaultArgs(KatStatusCode, "kataster_code") @@ -121,6 +121,7 @@ def LoadCaveTab(): if line[header]: addToDefaultArgs(header,"description_file") break + #The following checks if this cave is non-public i.e. we don't have rights to display it online. #Noinfo was the name of the old password protected directory, so if it has that then we will @@ -147,7 +148,7 @@ def LoadCaveTab(): newCave.area.add(area1623) newCave.save() - + logging.info("Added area "+line[Area]+" to cave "+str(newCave)+"\n") if created and line[UnofficialName]: @@ -155,13 +156,13 @@ def LoadCaveTab(): newUnofficialName.save() logging.info("Added unofficial name "+str(newUnofficialName)+" to cave "+str(newCave)+"\n") - + if created and line[MultipleEntrances] == '' or \ line[MultipleEntrances] == 'entrance' or \ line[MultipleEntrances] == 'last entrance': args = {} - + if line[Entrances]: entrance_letter = line[Entrances] else: @@ -222,14 +223,13 @@ def LoadCaveTab(): logging.info("Added entrance "+str(newEntrance)+"\n") - + newCaveAndEntrance = models.CaveAndEntrance(cave = newCave, entrance = newEntrance, entrance_letter = entrance_letter) newCaveAndEntrance.save() - + logging.info("Added CaveAndEntrance "+str(newCaveAndEntrance)+"\n") - if line[AutogenFile] != "": - f = flatpages.models.EntranceRedirect(originalURL = line[AutogenFile], entrance = newEntrance) - f.save() + f = flatpages.models.EntranceRedirect(originalURL = line[AutogenFile], entrance = newEntrance) + f.save() # lookup function modelled on GetPersonExpeditionNameLookup @@ -245,9 +245,9 @@ def GetCaveLookup(): Gcavelookup[cave.kataster_number] = cave if cave.unofficial_number: Gcavelookup[cave.unofficial_number] = cave - + Gcavelookup["tunnocks"] = Gcavelookup["258"] Gcavelookup["hauchhole"] = Gcavelookup["234"] return Gcavelookup - - + + diff --git a/urls.py b/urls.py index ea0ce0a..67c50ac 100644 --- a/urls.py +++ b/urls.py @@ -17,7 +17,7 @@ admin.autodiscover() actualurlpatterns = patterns('', - url(r'^troggle$', views_other.frontpage, name="frontpage"), + url(r'^$', views_other.frontpage, name="frontpage"), url(r'^todo/$', views_other.todo, name="todo"), url(r'^caves/?$', views_caves.caveindex, name="caveindex"),