summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/TESTS/tests.py6
-rw-r--r--core/utils.py10
-rw-r--r--core/views/survex.py7
-rw-r--r--parsers/caves.py5
4 files changed, 16 insertions, 12 deletions
diff --git a/core/TESTS/tests.py b/core/TESTS/tests.py
index 085890c..d13e1b0 100644
--- a/core/TESTS/tests.py
+++ b/core/TESTS/tests.py
@@ -19,9 +19,13 @@ https://docs.djangoproject.com/en/dev/topics/testing/tools/
"""
-todo = """ADD TESTS when we are redirecting /expofiles/ to a remote file-delivering site
+todo = """ - ADD TESTS when we are redirecting /expofiles/ to a remote file-delivering site
- Add test for running cavern to produce a .3d file
+
+- Add tests for editing the TXT files
+
+- add "author" tests for the git add and commit stuff for uploaded files, inc on DEVSERVER or not
"""
import re
diff --git a/core/utils.py b/core/utils.py
index 673dcee..8647d44 100644
--- a/core/utils.py
+++ b/core/utils.py
@@ -5,6 +5,7 @@ import os
import random
import re
import resource
+import socket
import string
import subprocess
from datetime import datetime, timezone
@@ -45,6 +46,8 @@ sha = hashlib.new('sha256')
COOKIE_MAX_AGE = 12*60*60 # seconds
throw = 35.0
+EXPOSERVER = "expo" # hostname of the server at expo.survex.com
+
DEV_OK = """On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
@@ -260,7 +263,12 @@ def git_commit(cwd, message, editor, commands=[]):
"""
git = settings.GIT
print(f"git commit in {cwd}")
- print(f"Committing:\n{message=}\n{editor=}")
+
+ if socket.gethostname() != EXPOSERVER:
+ message += f" on dev machine '{socket.gethostname()}'"
+ elif settings.DEVSERVER:
+ message += " on a dev machine using 'runserver'"
+ print(f"..{message=}\n..{editor=}")
cmd_commit = [git, "commit", "-m", message, "--author", f"{editor}"]
commands.append(cmd_commit)
diff --git a/core/views/survex.py b/core/views/survex.py
index 5707720..83f5af5 100644
--- a/core/views/survex.py
+++ b/core/views/survex.py
@@ -2,7 +2,6 @@ import datetime
import difflib
import os
import re
-import socket
from collections import namedtuple
from pathlib import Path
@@ -229,11 +228,7 @@ class SvxForm(forms.Form):
fout.write("\n")
fout.close()
- if socket.gethostname() == "expo":
- comment = f"Online survex edit: {self.data['filename']}.svx"
- else:
- comment = f"Online survex edit: {self.data['filename']}.svx on dev machine '{socket.gethostname()}' "
- print(f"Committing file which has been saved {editor=}")
+ comment = f"Online survex edit: {self.data['filename']}.svx"
add_commit(fname, comment, editor)
msg = f"SAVED and committed to git (if there were differences)\nEdited by:{editor}"
diff --git a/parsers/caves.py b/parsers/caves.py
index 4303726..05bc159 100644
--- a/parsers/caves.py
+++ b/parsers/caves.py
@@ -26,12 +26,9 @@ So is the first thing that creates tables.
"""
todo = """
-- When reading cave data, to start off wit we do not know the cave id (slug) so we can't give a useful url in
+- When reading cave data, to start off with we do not know the cave id (slug) so we can't give a useful url in
the error message, but we do have the filename. Systematize this, and the same thing with reading entrance files.
-- Cannot use Edit This Page for pendingcaves.txt_edit as Edit This Page is expecting an html file.
- So we will need a separate file-editing capability just for this configuration file ?!
-
- we want to overwrite a PENDING cave if we are now importing the 1623-xxx.html file for it
- rewrite archaic regex