summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/views/survex.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/views/survex.py b/core/views/survex.py
index 350c404..df8a629 100644
--- a/core/views/survex.py
+++ b/core/views/survex.py
@@ -104,10 +104,13 @@ class SvxForm(forms.Form):
outputtype = forms.CharField(widget=forms.TextInput(attrs={"readonly":True}))
code = forms.CharField(widget=forms.Textarea(attrs={"cols":150, "rows":36}))
+ template = False
+
def GetDiscCode(self):
fname = survexdatasetpath / (self.data['filename'] + ".svx")
if not os.path.isfile(fname):
print(">>> >>> WARNING - svx file not found, showing TEMPLATE SVX",fname, flush=True)
+ self.template = True
return survextemplatefile
fin = open(fname, "rt",encoding='utf8',newline='')
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
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
dirname = os.path.split(survex_file)[0]
dirname += "/"
@@ -210,7 +215,8 @@ def svx(request, survex_file):
#process(survex_file)
if 'code' not in form.data:
form.data['code'] = form.GetDiscCode()
-
+ if form.template:
+ warning = True
if not difflist:
difflist.append("none")
if message:
@@ -220,6 +226,7 @@ def svx(request, survex_file):
svxincludes = re.findall(r'\*include\s+(\S+)(?i)', form.data['code'] or "")
vmap = {'settings': settings,
+ 'warning': warning,
'has_3d': os.path.isfile(survexdatasetpath / survex_file / ".3d"),
'title': survex_file,
'svxincludes': svxincludes,