diff --git a/core/views/survex.py b/core/views/survex.py index 21d558e..935ecd9 100644 --- a/core/views/survex.py +++ b/core/views/survex.py @@ -271,17 +271,22 @@ def svx(request, survex_file): outputtype = rform.cleaned_data["outputtype"] # used by CodeMirror ajax I think difflist = form.DiffCode(rcode) # print(">>>> ", rform.data) + svxfile = form.survexfile if "revert" in rform.data: pass + if "process" in rform.data: - if not difflist: + if difflist: + message = "SAVE FILE FIRST" + form.data["code"] = rcode + elif svxfile: logmessage = form.Process() if logmessage: message = f"OUTPUT FROM PROCESSING\n{logmessage}" else: - message = "SAVE FILE FIRST" - form.data["code"] = rcode + message = "SAVE VALID FILE FIRST" + form.data["code"] = rcode if "save" in rform.data: if request.user.is_authenticated: message = form.SaveCode(rcode) @@ -293,7 +298,7 @@ def svx(request, survex_file): print("Differences: ") form.data["code"] = rcode - # process(survex_file) + # GET or after POST-specific handling svxfile = form.survexfile # only valid once form.GetDiscCode() called if "code" not in form.data: