2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11: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 - 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 - git clone (see below) the current latest troggle from the 'python3' git branch into
a folder called 'troggle' 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 - if you have those repos elsewhere, set up symlinks in the directory above troggle
so that troggle thinks they are siblings so that troggle thinks they are siblings
@ -157,6 +157,12 @@ which will give security warnings for deployment.
python manage.py check -Wall python manage.py check -Wall
Gives warnings of deprecated Django which should be fixed asap. 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 Registering troggle as a django application
------------------------------------------- -------------------------------------------
In your troggle directory run In your troggle directory run

View File

@ -48,7 +48,9 @@ def parseCaveQMs(cave,inputFile):
parse_KH_QMs(kh, inputFile=inputFile) parse_KH_QMs(kh, inputFile=inputFile)
return return
qmPath = settings.EXPOWEB+inputFile #qmPath = settings.EXPOWEB+inputFile
qmPath = os.path.join(settings.EXPOWEB, inputFile)
qmCSVContents = open(qmPath,'rU') qmCSVContents = open(qmPath,'rU')
dialect=csv.Sniffer().sniff(qmCSVContents.read()) dialect=csv.Sniffer().sniff(qmCSVContents.read())
qmCSVContents.seek(0,0) qmCSVContents.seek(0,0)
@ -105,7 +107,7 @@ def parseCaveQMs(cave,inputFile):
def parse_KH_QMs(kh, inputFile): def parse_KH_QMs(kh, inputFile):
"""import QMs from the 1623-161 (Kaninchenh<6E>hle) html pages """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() khQMs=khQMs.readlines()
for line in khQMs: 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) 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 raise
print(" - Reading Entrances from entrance descriptions xml files") 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 for filename in next(os.walk(settings.ENTRANCEDESCRIPTIONS))[2]: #Should be a better way of getting a list of files
if filename.endswith('.html'): if filename.endswith('.html'):
readentrance(filename) readentrance(filename)

View File

@ -4,6 +4,7 @@ import re
import time import time
import copy import copy
from unipath import Path
from datetime import datetime, timedelta from datetime import datetime, timedelta
from subprocess import call, run 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}". 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))) 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)]) 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)
topdata = settings.SURVEX_DATA + settings.SURVEX_TOPNAME 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.child(settings.SURVEX_TOPNAME)
print((' - Generating a list of Pos from %s.svx and then loading...' % (topdata))) print((' - Generating a list of Pos from %s.svx and then loading...' % (topdata)))
found = 0 found = 0

View File

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

View File

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