merging correct urls.py for /troggle dir in

This commit is contained in:
ExpoOnServer 2011-07-12 00:49:24 +01:00
commit 9f9fbe33be
2 changed files with 16 additions and 16 deletions

View File

@ -55,7 +55,7 @@ Findability = 44
FindabilityComment = 45 FindabilityComment = 45
def LoadCaveTab(): def LoadCaveTab():
cavetab = open(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV"),'rU') cavetab = open(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV"),'rU')
caveReader = csv.reader(cavetab) caveReader = csv.reader(cavetab)
caveReader.next() # Strip out column headers caveReader.next() # Strip out column headers
@ -69,7 +69,7 @@ def LoadCaveTab():
logging.info("Added area "+str(newArea.short_name)+"\n") logging.info("Added area "+str(newArea.short_name)+"\n")
area1626 = models.Area.objects.filter(short_name = '1626')[0] area1626 = models.Area.objects.filter(short_name = '1626')[0]
area1623 = models.Area.objects.filter(short_name = '1623')[0] area1623 = models.Area.objects.filter(short_name = '1623')[0]
counter=0 counter=0
for line in caveReader : for line in caveReader :
if line[Area] == 'nonexistent': if line[Area] == 'nonexistent':
@ -82,11 +82,11 @@ def LoadCaveTab():
def addToArgs(CSVname, modelName): def addToArgs(CSVname, modelName):
if line[CSVname]: if line[CSVname]:
args[modelName] = 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 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]: if line[CSVname]:
defaultArgs[modelName] = 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. # The attributes added using "addToArgs" will be used to look up an existing cave. Those added using "addToDefaultArgs" will not.
addToArgs(KatasterNumber, "kataster_number") addToArgs(KatasterNumber, "kataster_number")
addToDefaultArgs(KatStatusCode, "kataster_code") addToDefaultArgs(KatStatusCode, "kataster_code")
@ -121,7 +121,6 @@ def LoadCaveTab():
if line[header]: if line[header]:
addToDefaultArgs(header,"description_file") addToDefaultArgs(header,"description_file")
break break
#The following checks if this cave is non-public i.e. we don't have rights to display it online. #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 #Noinfo was the name of the old password protected directory, so if it has that then we will
@ -148,7 +147,7 @@ def LoadCaveTab():
newCave.area.add(area1623) newCave.area.add(area1623)
newCave.save() newCave.save()
logging.info("Added area "+line[Area]+" to cave "+str(newCave)+"\n") logging.info("Added area "+line[Area]+" to cave "+str(newCave)+"\n")
if created and line[UnofficialName]: if created and line[UnofficialName]:
@ -156,13 +155,13 @@ def LoadCaveTab():
newUnofficialName.save() newUnofficialName.save()
logging.info("Added unofficial name "+str(newUnofficialName)+" to cave "+str(newCave)+"\n") logging.info("Added unofficial name "+str(newUnofficialName)+" to cave "+str(newCave)+"\n")
if created and line[MultipleEntrances] == '' or \ if created and line[MultipleEntrances] == '' or \
line[MultipleEntrances] == 'entrance' or \ line[MultipleEntrances] == 'entrance' or \
line[MultipleEntrances] == 'last entrance': line[MultipleEntrances] == 'last entrance':
args = {} args = {}
if line[Entrances]: if line[Entrances]:
entrance_letter = line[Entrances] entrance_letter = line[Entrances]
else: else:
@ -223,13 +222,14 @@ def LoadCaveTab():
logging.info("Added entrance "+str(newEntrance)+"\n") logging.info("Added entrance "+str(newEntrance)+"\n")
newCaveAndEntrance = models.CaveAndEntrance(cave = newCave, entrance = newEntrance, entrance_letter = entrance_letter) newCaveAndEntrance = models.CaveAndEntrance(cave = newCave, entrance = newEntrance, entrance_letter = entrance_letter)
newCaveAndEntrance.save() newCaveAndEntrance.save()
logging.info("Added CaveAndEntrance "+str(newCaveAndEntrance)+"\n") logging.info("Added CaveAndEntrance "+str(newCaveAndEntrance)+"\n")
f = flatpages.models.EntranceRedirect(originalURL = line[AutogenFile], entrance = newEntrance) if line[AutogenFile] != "":
f.save() f = flatpages.models.EntranceRedirect(originalURL = line[AutogenFile], entrance = newEntrance)
f.save()
# lookup function modelled on GetPersonExpeditionNameLookup # lookup function modelled on GetPersonExpeditionNameLookup
@ -245,9 +245,9 @@ def GetCaveLookup():
Gcavelookup[cave.kataster_number] = cave Gcavelookup[cave.kataster_number] = cave
if cave.unofficial_number: if cave.unofficial_number:
Gcavelookup[cave.unofficial_number] = cave Gcavelookup[cave.unofficial_number] = cave
Gcavelookup["tunnocks"] = Gcavelookup["258"] Gcavelookup["tunnocks"] = Gcavelookup["258"]
Gcavelookup["hauchhole"] = Gcavelookup["234"] Gcavelookup["hauchhole"] = Gcavelookup["234"]
return Gcavelookup return Gcavelookup

View File

@ -17,7 +17,7 @@ admin.autodiscover()
actualurlpatterns = patterns('', actualurlpatterns = patterns('',
url(r'^$', views_other.frontpage, name="frontpage"), url(r'^troggle$', views_other.frontpage, name="frontpage"),
url(r'^todo/$', views_other.todo, name="todo"), url(r'^todo/$', views_other.todo, name="todo"),
url(r'^caves/?$', views_caves.caveindex, name="caveindex"), url(r'^caves/?$', views_caves.caveindex, name="caveindex"),