Add odt and ods mime types to our list.

Maybe this should just be read in from the real list...
This commit is contained in:
Wookey 2011-07-12 00:57:48 +01:00
parent 9e5e636d0d
commit f60c4cba23
3 changed files with 18 additions and 16 deletions

View File

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

View File

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

View File

@ -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"),