diff options
author | Philip Sargent <philip.sargent@klebos.com> | 2022-08-16 16:48:19 +0300 |
---|---|---|
committer | Philip Sargent <philip.sargent@klebos.com> | 2022-08-16 16:48:19 +0300 |
commit | 51f5261bfccbcc1358bc9b6aaf3f0ce5244aabc4 (patch) | |
tree | d450b4dc81c2dd8edaa1d5b77ecc87ae80df8435 /core/views/uploads.py | |
parent | b2d8b218224f0a08f2e01c33ae8f5e8fb8a9429f (diff) | |
download | troggle-51f5261bfccbcc1358bc9b6aaf3f0ce5244aabc4.tar.gz troggle-51f5261bfccbcc1358bc9b6aaf3f0ce5244aabc4.tar.bz2 troggle-51f5261bfccbcc1358bc9b6aaf3f0ce5244aabc4.zip |
bad bug in not clearing out previous data. fixed
Diffstat (limited to 'core/views/uploads.py')
-rw-r--r-- | core/views/uploads.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py index 82e34c1..0cc3f93 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -252,7 +252,7 @@ def scanupload(request, path=None): print(message) return render(request,'errors/generic.html', {'message': message}) else: - dr_commit = subprocess.run([git, "commit", "-m", f'Update of {contentsjson} in wallet'], cwd=destfolder, capture_output=True, text=True) + dr_commit = subprocess.run([git, "commit", "-m", f'JSON update for wallet {wallet}'], cwd=destfolder, capture_output=True, text=True) # This produces return code = 1 if it commits OK if dr_commit.returncode != 0: msgdata = 'Ask a nerd to fix this.\n\n' + dr_commit.stderr + '\n\n' + dr_commit.stdout + '\n\nreturn code: ' + str(dr_commit.returncode) @@ -366,7 +366,9 @@ def scanupload(request, path=None): #f = request.FILES["uploadfiles"] multiple = request.FILES.getlist('uploadfiles') fs = FileSystemStorage(os.path.join(dirpath)) # creates wallet folder if necessary - + + wd = wallet_blank_json # clean this out + waldata = {} # clean this out actual_saved = [] if multiple: for f in multiple: @@ -386,7 +388,7 @@ def scanupload(request, path=None): dirs = [] # print(f'! - FORM scanupload - start {wallet} {dirpath}') if dirpath.is_dir(): - create = False + create = False # wallet exists becausse folder exists, even if nothing in it try: for f in dirpath.iterdir(): if f.is_dir(): @@ -405,7 +407,8 @@ def scanupload(request, path=None): dirs = sorted(dirs) waldata = {} - if contents_path.is_file(): + if contents_path.is_file(): + create = False # yes wallet exists becaue JSON exists, even if no files in the surveyscans folder, or even if that folder does not exist with open(contents_path) as json_file: try: waldata = json.load(json_file) |