diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-03-06 01:29:45 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-03-06 01:29:45 +0000 |
commit | 3ac617431f41c9bb85636c68d1aef72feb3944ff (patch) | |
tree | 094215a52b0cc85bfc7614a8fe23ce3f5beeaad3 /core | |
parent | 7a58aac08eb0b19b05f84955d855d8af6bb369de (diff) | |
download | troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.tar.gz troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.tar.bz2 troggle-3ac617431f41c9bb85636c68d1aef72feb3944ff.zip |
Make .3d files in same dir as .svx
Diffstat (limited to 'core')
-rw-r--r-- | core/TESTS/tests_logins.py | 4 | ||||
-rw-r--r-- | core/fixtures/test_upload_file.pdf | 5 | ||||
-rw-r--r-- | core/models/caves.py | 14 | ||||
-rw-r--r-- | core/views/statistics.py | 2 |
4 files changed, 18 insertions, 7 deletions
diff --git a/core/TESTS/tests_logins.py b/core/TESTS/tests_logins.py index b09b7b6..e07907f 100644 --- a/core/TESTS/tests_logins.py +++ b/core/TESTS/tests_logins.py @@ -108,7 +108,7 @@ class PostTests(TestCase): def test_dwg_upload_txt(self): - '''Expect .txt file to be refused upload + '''Expect .pdf file to be refused upload Need to login first. ''' c = self.client @@ -118,7 +118,7 @@ class PostTests(TestCase): self.assertTrue(u.is_active, 'User \'' + u.username + '\' is INACTIVE') logged_in = c.login(username=u.username, password='secretword') - with open('core/fixtures/test_upload_file.txt','r') as testf: + with open('core/fixtures/test_upload_file.pdf','r') as testf: response = self.client.post('/dwgupload/uploads', data={'name': 'test_upload_file.txt', 'uploadfiles': testf }) content = response.content.decode() self.assertEqual(response.status_code, 200) diff --git a/core/fixtures/test_upload_file.pdf b/core/fixtures/test_upload_file.pdf new file mode 100644 index 0000000..9d955a5 --- /dev/null +++ b/core/fixtures/test_upload_file.pdf @@ -0,0 +1,5 @@ +This file is uploaded by the integration test suite as part of the tests.
+
+It, and any other with similar names, e.g test_upload_GPev9qN.txt can be safely deleted,
+EXCEPT for the original copy which lives in troggle/core/fixtures/
+
diff --git a/core/models/caves.py b/core/models/caves.py index 0a4cc3e..41a1b47 100644 --- a/core/models/caves.py +++ b/core/models/caves.py @@ -3,7 +3,8 @@ import os import datetime import re import json -from subprocess import call +import subprocess + from collections import defaultdict from pathlib import Path @@ -56,8 +57,15 @@ def writetrogglefile(filepath, filecontent): f.write(filecontent) #os.chmod(filepath, 0o664) # set file permissions to rw-rw-r-- # should replace .call with .run and capture_output=True - call([git, "add", filename], cwd=cwd) - call([git, "commit", "-m", f'Troggle online: cave or entrance edit -{filename}'], cwd=cwd) + sp = subprocess.run([git, "add", filename], cwd=cwd, capture_output=True, check=True, text=True) + if sp.returncode != 0: + print(f'git ADD {cwd}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) + + sp = subprocess.run([git, "commit", "-m", f'Troggle online: cave or entrance edit -{filename}'], cwd=cwd, capture_output=True, check=True, text=True) + if sp.returncode != 0: + print(f'git COMMIT {cwd}:\n\n' + str(sp.stderr) + '\n\n' + str(sp.stdout) + '\n\nreturn code: ' + str(sp.returncode)) + # not catching and re-raising any exceptions yet, inc. the stderr etc.,. We should do that. + class Area(TroggleModel): diff --git a/core/views/statistics.py b/core/views/statistics.py index 054c3a4..950b147 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -53,7 +53,6 @@ def pathsreport(request): "SURVEYS" : str( settings.SURVEYS), "SURVEYS_URL" : str( settings.SURVEYS_URL), "SURVEXPORT" : str( settings.SURVEXPORT), - "THREEDCACHEDIR" : str( settings.THREEDCACHEDIR), "DRAWINGS_DATA" : str( settings.DRAWINGS_DATA), "URL_ROOT" : str( settings.URL_ROOT) } @@ -91,7 +90,6 @@ def pathsreport(request): "SURVEYS" : type(settings.SURVEYS), "SURVEYS_URL" : type(settings.SURVEYS_URL), "SURVEXPORT" : type(settings.SURVEXPORT), - "THREEDCACHEDIR" : type(settings.THREEDCACHEDIR), "DRAWINGS_DATA" : type(settings.DRAWINGS_DATA), "URL_ROOT" : type(settings.URL_ROOT) } |