forked from expo/troggle
New debug page for subprocess runs
This commit is contained in:
parent
b359937eab
commit
21ad6ecffb
@ -318,12 +318,17 @@ def editexpopage(request, path):
|
|||||||
# see also core/models/cave.py writetrogglefile()
|
# see also core/models/cave.py writetrogglefile()
|
||||||
f.write(result)
|
f.write(result)
|
||||||
# should replace .call with .run and capture_output=True
|
# should replace .call with .run and capture_output=True
|
||||||
subprocess.call([git, "add", filename], cwd=cwd)
|
|
||||||
subprocess.call([git, "commit", "-m", 'Edit this page'], cwd=cwd)
|
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {filename}. Ask a nerd to fix this.'
|
message = f'CANNOT save this file.\nPERMISSIONS incorrectly set on server for this file {filename}. Ask a nerd to fix this.'
|
||||||
return render(request,'errors/generic.html', {'message': message})
|
return render(request,'errors/generic.html', {'message': message})
|
||||||
except SubprocessError:
|
|
||||||
|
try:
|
||||||
|
cp1 = subprocess.run([git, "add", filename], cwd=cwd, capture_output=True)
|
||||||
|
cp2 = subprocess.run([git, "commit", "-m", 'Edit this page'], cwd=cwd, capture_output=True)
|
||||||
|
message = f'Test output this file {filename}. git command output.\n' + str(cp1) + '\n\n' + str(cp2)
|
||||||
|
return render(request,'errors/debug.html', {'message': message})
|
||||||
|
|
||||||
|
except subprocess.SubprocessError:
|
||||||
message = f'CANNOT git on server for this file {filename}. Edits not saved.\nAsk a nerd to fix this.'
|
message = f'CANNOT git on server for this file {filename}. Edits not saved.\nAsk a nerd to fix this.'
|
||||||
return render(request,'errors/generic.html', {'message': message})
|
return render(request,'errors/generic.html', {'message': message})
|
||||||
|
|
||||||
|
50
templates/errors/debug.html
Normal file
50
templates/errors/debug.html
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Troggle Debug - Generic page{% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class='middle'>
|
||||||
|
<h2>Troggle Debug Page</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class='middle3 login'>
|
||||||
|
<div class='space'></div>
|
||||||
|
<div class='align-center'>
|
||||||
|
<h3>This is temporary debugging output. There has NOT been an error.</h3>
|
||||||
|
<h4>
|
||||||
|
|
||||||
|
<font color="red">
|
||||||
|
{% if message %}
|
||||||
|
<pre>
|
||||||
|
{{message}}
|
||||||
|
</pre>
|
||||||
|
{% else %}
|
||||||
|
<p>Placeholder. </p>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
</font>
|
||||||
|
</h4>
|
||||||
|
<div class='space'><p> </div>
|
||||||
|
|
||||||
|
<h3>What you should do now</h3>
|
||||||
|
<p>Please report this by emailing the nerds at
|
||||||
|
<a href="mailto:expo-tech@lists.wookware.org">expo-tech@lists.wookware.org</a> with this information:
|
||||||
|
<ol>
|
||||||
|
<li>The message written in <font color="red">red</font> above.
|
||||||
|
<li>The previous page URL: <font color="red">
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.write(document.referrer);
|
||||||
|
</script></font>
|
||||||
|
<li>Go back to this previous page <script type="text/javascript">
|
||||||
|
document.write("<a href='",document.referrer,"'>",document.referrer,"</a>");
|
||||||
|
</script>
|
||||||
|
and see if you can tell whether the page causing the debug output was in HTML text which had been written manually, or whether it appeared to be a programming intention.
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
Loading…
Reference in New Issue
Block a user