mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-26 09:11:54 +00:00
better integration of svx file DatIssues
This commit is contained in:
parent
db3addc819
commit
d598a6d0f5
@ -104,10 +104,13 @@ class SvxForm(forms.Form):
|
|||||||
outputtype = forms.CharField(widget=forms.TextInput(attrs={"readonly":True}))
|
outputtype = forms.CharField(widget=forms.TextInput(attrs={"readonly":True}))
|
||||||
code = forms.CharField(widget=forms.Textarea(attrs={"cols":150, "rows":36}))
|
code = forms.CharField(widget=forms.Textarea(attrs={"cols":150, "rows":36}))
|
||||||
|
|
||||||
|
template = False
|
||||||
|
|
||||||
def GetDiscCode(self):
|
def GetDiscCode(self):
|
||||||
fname = survexdatasetpath / (self.data['filename'] + ".svx")
|
fname = survexdatasetpath / (self.data['filename'] + ".svx")
|
||||||
if not os.path.isfile(fname):
|
if not os.path.isfile(fname):
|
||||||
print(">>> >>> WARNING - svx file not found, showing TEMPLATE SVX",fname, flush=True)
|
print(">>> >>> WARNING - svx file not found, showing TEMPLATE SVX",fname, flush=True)
|
||||||
|
self.template = True
|
||||||
return survextemplatefile
|
return survextemplatefile
|
||||||
fin = open(fname, "rt",encoding='utf8',newline='')
|
fin = open(fname, "rt",encoding='utf8',newline='')
|
||||||
svxtext = fin.read()
|
svxtext = fin.read()
|
||||||
@ -167,6 +170,8 @@ def svx(request, survex_file):
|
|||||||
editing) with buttons which allow SAVE, check for DIFFerences from saved, and RUN (which runs the
|
editing) with buttons which allow SAVE, check for DIFFerences from saved, and RUN (which runs the
|
||||||
cavern executable and displays the output below the main textarea). Requires CSRF to be set upcorrect;ly, and requires permission to write to the filesystem.
|
cavern executable and displays the output below the main textarea). Requires CSRF to be set upcorrect;ly, and requires permission to write to the filesystem.
|
||||||
'''
|
'''
|
||||||
|
warning = False
|
||||||
|
|
||||||
# get the basic data from the file given in the URL
|
# get the basic data from the file given in the URL
|
||||||
dirname = os.path.split(survex_file)[0]
|
dirname = os.path.split(survex_file)[0]
|
||||||
dirname += "/"
|
dirname += "/"
|
||||||
@ -210,7 +215,8 @@ def svx(request, survex_file):
|
|||||||
#process(survex_file)
|
#process(survex_file)
|
||||||
if 'code' not in form.data:
|
if 'code' not in form.data:
|
||||||
form.data['code'] = form.GetDiscCode()
|
form.data['code'] = form.GetDiscCode()
|
||||||
|
if form.template:
|
||||||
|
warning = True
|
||||||
if not difflist:
|
if not difflist:
|
||||||
difflist.append("none")
|
difflist.append("none")
|
||||||
if message:
|
if message:
|
||||||
@ -220,6 +226,7 @@ def svx(request, survex_file):
|
|||||||
svxincludes = re.findall(r'\*include\s+(\S+)(?i)', form.data['code'] or "")
|
svxincludes = re.findall(r'\*include\s+(\S+)(?i)', form.data['code'] or "")
|
||||||
|
|
||||||
vmap = {'settings': settings,
|
vmap = {'settings': settings,
|
||||||
|
'warning': warning,
|
||||||
'has_3d': os.path.isfile(survexdatasetpath / survex_file / ".3d"),
|
'has_3d': os.path.isfile(survexdatasetpath / survex_file / ".3d"),
|
||||||
'title': survex_file,
|
'title': survex_file,
|
||||||
'svxincludes': svxincludes,
|
'svxincludes': svxincludes,
|
||||||
|
@ -43,31 +43,34 @@ def readcaves():
|
|||||||
print (" - Setting pending caves")
|
print (" - Setting pending caves")
|
||||||
# Do this first, so that these empty entries are overwritten as they get properly created.
|
# Do this first, so that these empty entries are overwritten as they get properly created.
|
||||||
|
|
||||||
# For those caves which do not have XML files even though they exist and have surveys
|
# For those caves which do not have cave_data/1623-xxx.html XML files even though they exist and have surveys
|
||||||
# also needs to be done *before* entrances so that the entrance-cave links work properly.
|
# also needs to be done *before* entrances so that the entrance-cave links work properly.
|
||||||
pending = ["2007-04", "2007-05", "2007-06", "2007-07", "2007-12", "2009-01", "2009-02",
|
pending = ["2007-04", "2007-05", "2007-06", "2007-07", "2007-12", "2009-01", "2009-02",
|
||||||
"2010-06", "2010-07", "2012-ns-01", "2012-ns-02", "2010-04", "2012-ns-05", "2012-ns-06",
|
"2010-06", "2010-07", "2012-ns-01", "2012-ns-02", "2010-04", "2012-ns-05", "2012-ns-06",
|
||||||
"2012-ns-07", "2012-ns-08", "2012-ns-12", "2012-ns-14", "2012-ns-15", "2014-bl888",
|
"2012-ns-07", "2012-ns-08", "2012-ns-12", "2012-ns-14", "2012-ns-15", "2014-bl888",
|
||||||
"2018-pf-01", "2018-pf-02", "haldenloch", "gruenstein"]
|
"2018-pf-01", "2018-pf-02", "haldenloch"]
|
||||||
for k in pending:
|
for k in pending:
|
||||||
|
url = "1623/" + k
|
||||||
try:
|
try:
|
||||||
cave = Cave(
|
cave = Cave(
|
||||||
unofficial_number = k,
|
unofficial_number = k,
|
||||||
# official_name = "",
|
# official_name = "",
|
||||||
underground_description = "Pending cave write-up - creating as empty object. No XML file available yet.",
|
underground_description = "Pending cave write-up - creating as empty object. No XML file available yet.",
|
||||||
notes="_Survex file found in loser repo but no description in expoweb")
|
survex_file = "caves-1623/" + k + "/" + k +".svx",
|
||||||
|
url = url,
|
||||||
|
notes="_Survex file found in loser repo but no description in expoweb")
|
||||||
if cave:
|
if cave:
|
||||||
cave.save() # must save to have id before foreign keys work. This is also a ManyToMany key.
|
cave.save() # must save to have id before foreign keys work. This is also a ManyToMany key.
|
||||||
#print(f' ! - READ CAVES: cave {k} {cave}')
|
#print(f' ! - READ CAVES: cave {k} {cave}')
|
||||||
cave.area.add(area_1623[0])
|
cave.area.add(area_1623[0])
|
||||||
cave.save()
|
cave.save()
|
||||||
message = " ! {:11s} {}".format(cave.unofficial_number, cave.underground_description)
|
message = " ! {:11s} {}".format(cave.unofficial_number, cave.underground_description)
|
||||||
DataIssue.objects.create(parser='caves', message=message)
|
DataIssue.objects.create(parser='caves', message=message, url=url)
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
try: # Now create a cave slug ID
|
try: # Now create a cave slug ID
|
||||||
cs = CaveSlug.objects.update_or_create(cave = cave,
|
cs = CaveSlug.objects.update_or_create(cave = cave,
|
||||||
slug = "TEMP-" + k,
|
slug = "1623-PENDING-" + k,
|
||||||
primary = False)
|
primary = False)
|
||||||
except:
|
except:
|
||||||
message = " ! {:11s} {} PENDING cave slug create failure".format(k)
|
message = " ! {:11s} {} PENDING cave slug create failure".format(k)
|
||||||
@ -316,6 +319,8 @@ def readcave(filename):
|
|||||||
message = f' ! description filename does not exist :{EXPOWEB}:"{description_file[0]}" in "{filename}"'
|
message = f' ! description filename does not exist :{EXPOWEB}:"{description_file[0]}" in "{filename}"'
|
||||||
DataIssue.objects.create(parser='caves', message=message, url=f'/cave/{slug}/edit/')
|
DataIssue.objects.create(parser='caves', message=message, url=f'/cave/{slug}/edit/')
|
||||||
print(message)
|
print(message)
|
||||||
|
#c.description_file="" # done only once, to clear out cruft.
|
||||||
|
#c.save()
|
||||||
|
|
||||||
def getXML(text, itemname, minItems = 1, maxItems = None, printwarnings = True, context = ""):
|
def getXML(text, itemname, minItems = 1, maxItems = None, printwarnings = True, context = ""):
|
||||||
items = re.findall("<%(itemname)s>(.*?)</%(itemname)s>" % {"itemname": itemname}, text, re.S)
|
items = re.findall("<%(itemname)s>(.*?)</%(itemname)s>" % {"itemname": itemname}, text, re.S)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<h1>Loading data from files: Issues arising that need attention</h1>
|
<h1>Loading data from files: Issues arising that need attention</h1>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
This is work in progress (April 2021).The URL links to the offending objects are not enabled yet.
|
This is work in progress (April 2021).The URL links to the offending objects are enabled on only some types of fault as yet.
|
||||||
<style>
|
<style>
|
||||||
tr { text-align:center;
|
tr { text-align:center;
|
||||||
font-family: Tahoma,'Trebuchet MS','Lucida Grande',Verdana, Arial, Helvetica, Sans-Serif;
|
font-family: Tahoma,'Trebuchet MS','Lucida Grande',Verdana, Arial, Helvetica, Sans-Serif;
|
||||||
@ -19,8 +19,8 @@ td { background : lightblue; }
|
|||||||
<table>
|
<table>
|
||||||
<tr><th>Parser</th><th>Issue</th></tr>
|
<tr><th>Parser</th><th>Issue</th></tr>
|
||||||
{% for di in didict %}
|
{% for di in didict %}
|
||||||
{% ifchanged di.parser %}
|
{% ifchanged di.parser %}<!-- this combination of ifchnaged + cycle is a Django template idiom -->
|
||||||
<tr {% cycle 'LightGoldenRodYellow' 'lightcyan' as mycolor %}>
|
<tr {% cycle 'LightGoldenRodYellow' 'palegreen' 'lightcyan' 'gainsboro' 'paleturquoise' as mycolor %}>
|
||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
{% endifchanged %}
|
{% endifchanged %}
|
||||||
|
@ -38,7 +38,11 @@ $(document).ready(function()
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% if warning %}
|
||||||
|
<h1 style="color: red">Survex Template - will save as file '{{ title }}.svx'</h1>
|
||||||
|
{% else %}
|
||||||
<h1>Survex File: {{ title }}</h1>
|
<h1>Survex File: {{ title }}</h1>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if svxincludes %}
|
{% if svxincludes %}
|
||||||
<p><b>Included files:</b>
|
<p><b>Included files:</b>
|
||||||
|
Loading…
Reference in New Issue
Block a user