diff --git a/core/views/expo.py b/core/views/expo.py index 6c79771..8b3e27e 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -318,12 +318,17 @@ def editexpopage(request, path): # see also core/models/cave.py writetrogglefile() f.write(result) # 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: 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}) - 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.' return render(request,'errors/generic.html', {'message': message}) diff --git a/templates/errors/debug.html b/templates/errors/debug.html new file mode 100644 index 0000000..c2cc025 --- /dev/null +++ b/templates/errors/debug.html @@ -0,0 +1,50 @@ +{% extends 'base.html' %} + +{% block title %}Troggle Debug - Generic page{% endblock %} +{% block content %} + +
+

Troggle Debug Page

+
+ + +
+
+
+

This is temporary debugging output. There has NOT been an error.

+

+ + + {% if message %} +
+            {{message}}
+        
+ {% else %} +

Placeholder.

+ + {% endif %} +
+

+

 

+ +

What you should do now

+

Please report this by emailing the nerds at + expo-tech@lists.wookware.org with this information: +

    +
  1. The message written in red above. +
  2. The previous page URL: + +
  3. Go back to this previous page + 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. +
+ + +
+
+ + +{% endblock %} \ No newline at end of file