2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-21 23:01:52 +00:00

Fixing cave list webpage

This commit is contained in:
Philip Sargent 2021-03-24 00:55:36 +00:00
parent a9fa251fee
commit 7f37327bcd
6 changed files with 19 additions and 7 deletions

View File

@ -23,7 +23,7 @@ Setting up directories
- create a directory in which you also have the loser/, expoweb/ and drawings/ repositories
- git clone (see below) the current latest troggle from the 'python3' git branch into
a folder called 'troggle'
- all the 4 repos should now be siblings, and also siblings with expofiles/
- all the 4 repos should now be siblings, and also siblings with expofiles/ and expowebcache/
- if you have those repos elsewhere, set up symlinks in the directory above troggle
so that troggle thinks they are siblings
@ -157,6 +157,12 @@ which will give security warnings for deployment.
python manage.py check -Wall
Gives warnings of deprecated Django which should be fixed asap.
python manage.py test core
Runs our test suite
python manage.py test
Runs tests for all the django plugins ("apps")
Registering troggle as a django application
-------------------------------------------
In your troggle directory run

View File

@ -48,7 +48,9 @@ def parseCaveQMs(cave,inputFile):
parse_KH_QMs(kh, inputFile=inputFile)
return
qmPath = settings.EXPOWEB+inputFile
#qmPath = settings.EXPOWEB+inputFile
qmPath = os.path.join(settings.EXPOWEB, inputFile)
qmCSVContents = open(qmPath,'rU')
dialect=csv.Sniffer().sniff(qmCSVContents.read())
qmCSVContents.seek(0,0)
@ -105,7 +107,7 @@ def parseCaveQMs(cave,inputFile):
def parse_KH_QMs(kh, inputFile):
"""import QMs from the 1623-161 (Kaninchenh<6E>hle) html pages
"""
khQMs=open(settings.EXPOWEB+inputFile,'r')
khQMs=open(os.path.join(settings.EXPOWEB, inputFile),'r')
khQMs=khQMs.readlines()
for line in khQMs:
res=re.search('name=\"[CB](?P<year>\d*)-(?P<cave>\d*)-(?P<number>\d*).*</a> (?P<grade>[ABDCV])<dd>(?P<description>.*)\[(?P<nearest_station>.*)\]',line)

View File

@ -53,6 +53,7 @@ def readcaves():
raise
print(" - Reading Entrances from entrance descriptions xml files")
print(" - settings.CAVEDESCRIPTIONS: ", settings.CAVEDESCRIPTIONS)
for filename in next(os.walk(settings.ENTRANCEDESCRIPTIONS))[2]: #Should be a better way of getting a list of files
if filename.endswith('.html'):
readentrance(filename)

View File

@ -4,6 +4,7 @@ import re
import time
import copy
from unipath import Path
from datetime import datetime, timedelta
from subprocess import call, run
@ -1252,10 +1253,11 @@ def LoadPositions():
print(" - Regenerating stale cavern .log and .3d for '{}'\n days old: {:.1f} {:.1f} {:.1f}".
format(topdata, (svx_t - d3d_t)/(24*3600), (cav_t - d3d_t)/(24*3600), (now - d3d_t)/(24*3600)))
call([settings.CAVERN, "--log", "--output={}".format(topdata), "{}.svx".format(topdata)])
print(" - Regenerating {} {}.3d in {}".format(settings.THREEDTOPOS, topdata, settings.SURVEX_DATA))
call([settings.THREEDTOPOS, '{}.3d'.format(topdata)], cwd = settings.SURVEX_DATA)
print(" - Regenerating {} {}.3d in {}".format(settings.SURVEXPORT, topdata, settings.SURVEX_DATA))
call([settings.SURVEXPORT, '--pos', '{}.3d'.format(topdata)], cwd = settings.SURVEX_DATA)
topdata = settings.SURVEX_DATA + settings.SURVEX_TOPNAME
topdata = settings.SURVEX_DATA.child(settings.SURVEX_TOPNAME)
print((' - Generating a list of Pos from %s.svx and then loading...' % (topdata)))
found = 0

View File

@ -5,3 +5,4 @@ docutils==0.16
Pillow==7.2.0
pytz==2020.1
Unidecode==1.1.1
Unipath==1.1

View File

@ -6,7 +6,7 @@
{% block content %}
<h1>Surveys for {{cave}}</h1>
<h1>Surveys for cave - kataster number:{{cave}}</h1>
<p>
{% for survexdirectory in cave.survexdirectory_set.all %}