diff options
-rw-r--r-- | core/views/uploads.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/views/uploads.py b/core/views/uploads.py index ee2b8d9..02d8c1e 100644 --- a/core/views/uploads.py +++ b/core/views/uploads.py @@ -261,7 +261,7 @@ def scanupload(request, path=None): print(f'wallet string {walletname}, FAIL TO GET or create WALLET OBJECT') raise - def commit_json(): + def commit_json(waldata): destfolder = contents_path.parent dr_add = subprocess.run([git, "add", contentsjson], cwd=destfolder, capture_output=True, text=True) if dr_add.returncode != 0: @@ -274,8 +274,15 @@ def scanupload(request, path=None): comment = f"on dev machine '{socket.gethostname()}' " else: comment = "" + if waldata["cave"]: + label = waldata["cave"] + else: + if waldata["name"]: + label = waldata["name"] + else: + label = "" - dr_commit = subprocess.run([git, "commit", "-m", f'JSON update for wallet {wallet} {comment}'], cwd=destfolder, capture_output=True, text=True) + dr_commit = subprocess.run([git, "commit", "-m", f'JSON update wallet {wallet} {label} {comment}'], 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) @@ -368,7 +375,7 @@ def scanupload(request, path=None): save_json(wd) make_wallet(wallet) - commit_json() + commit_json(wd) else: print(f'--- INVALID JSON Update form submitted') @@ -406,7 +413,7 @@ def scanupload(request, path=None): filesaved = True save_json(wallet_blank_json) make_wallet(wallet) - commit_json() + commit_json(waldata) files = [] dirs = [] # print(f'! - FORM scanupload - start {wallet} {dirpath}') |