Fixed delete text
This commit is contained in:
parent
c51f07d2fc
commit
a1cc2a410b
|
@ -29,11 +29,11 @@ with open(NOTES_PTH) as infile:
|
|||
try:
|
||||
notesJson = json.load(infile)
|
||||
for entry in notesJson:
|
||||
notesListEncoded.append(escape(entry))
|
||||
notesListEncoded.append(entry)
|
||||
entryDecoded = str(base64.urlsafe_b64decode( entry.encode("utf-8") ), "utf-8")
|
||||
notesListDecoded.append(entryDecoded)
|
||||
notesListDecoded.append(escape(entryDecoded))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(repr(e))
|
||||
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ def editFile():
|
|||
except Exception as e:
|
||||
errorMsg = str(e)
|
||||
print("Exception for editing action:")
|
||||
print(e)
|
||||
print(repr(e))
|
||||
|
||||
if editedFile:
|
||||
msg = "[Success] Renamed File!"
|
||||
|
@ -128,7 +128,7 @@ def deleteFile():
|
|||
fname = file[0]
|
||||
except Exception as e:
|
||||
print("Exception for deletiong action:")
|
||||
print(e)
|
||||
print(repr(e))
|
||||
errorMsg = str(e)
|
||||
|
||||
if deletedFile:
|
||||
|
@ -146,8 +146,9 @@ def deleteFile():
|
|||
def deleteText():
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
encodedNote = request.values['encodedstr'].strip()
|
||||
decodedNote = str(base64.urlsafe_b64decode( encodedNote.encode("utf-8") ), "utf-8")
|
||||
decodedNote = request.values['noteStr'].strip()
|
||||
encodedBytes = base64.urlsafe_b64encode(decodedNote.encode("utf-8"))
|
||||
encodedNote = str(encodedBytes, "utf-8")
|
||||
|
||||
notesListEncoded.remove(encodedNote)
|
||||
notesListDecoded.remove(decodedNote)
|
||||
|
@ -156,7 +157,7 @@ def deleteText():
|
|||
msg = "[Success] Deleted entry..."
|
||||
return msgHandler.createMessageJSON("success", msg)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(repr(e))
|
||||
|
||||
msg = "[Error] Failed to delete entry!"
|
||||
return msgHandler.createMessageJSON("danger", msg)
|
||||
|
@ -170,7 +171,7 @@ def deleteAllText():
|
|||
msg = "[Success] Deleted all enteries..."
|
||||
return msgHandler.createMessageJSON("success", msg)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print(repr(e))
|
||||
|
||||
msg = "[Error] Failed to delete all enteries!"
|
||||
return msgHandler.createMessageJSON("danger", msg)
|
||||
|
@ -192,7 +193,7 @@ def addNote():
|
|||
return msgHandler.createMessageJSON("success", msg)
|
||||
except Exception as e:
|
||||
print("Exception for file write action:")
|
||||
print(e)
|
||||
print(repr(e))
|
||||
msg = "[Error] A text entry write error occured!"
|
||||
return msgHandler.createMessageJSON("danger", msg)
|
||||
else:
|
||||
|
|
|
@ -70,8 +70,7 @@ const deleteTextAction = (elm, note) => {
|
|||
const refElm = document.getElementsByClassName(classRef)[0];
|
||||
refElm.parentElement.removeChild(refElm);
|
||||
|
||||
const encodedstr = btoa(note);
|
||||
const params = new URLSearchParams('encodedstr=' + encodedstr)
|
||||
const params = new URLSearchParams('noteStr=' + note)
|
||||
doAjax('delete-text', params, 'delete-text');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue