Skip to content
Snippets Groups Projects
Commit 17721413 authored by Jonas Leder's avatar Jonas Leder
Browse files

documentation

parent 0111ece5
No related branches found
No related tags found
No related merge requests found
Pipeline #236 passed
......@@ -7,17 +7,17 @@ def deleteLink(request, s):
loginbar = "Hello " + s.loads(request.cookies.get('username')) + ' (<a href="/user/logout" style="color:white">logout</a>)' # generate the login form
loginbar = loginbar + "" #to hide the unused variable message
except:
return redirect("/user/login") # if user is not logged in redirect him to the login page
abort(404) #if the user is not logged in, hide this page and return not found
linkToDelete = request.args.get('link') #get the link, which the user want's to delete from the parameter in the url.
with connect('db/urls.db') as conn:
cursor = conn.cursor()
try:
cursor.execute('DELETE FROM WEB_URL WHERE SHORT_URL=? AND USERNAME=?', [linkToDelete, userID]) #Delete the entrie
cursor.execute('DELETE FROM ANALYTICS WHERE SHORT_URL=?', [linkToDelete]) #Delete the entrie
cursor.execute('DELETE FROM WEB_URL WHERE SHORT_URL=? AND USERNAME=?', [linkToDelete, userID]) #Delete the mapping
cursor.execute('DELETE FROM ANALYTICS WHERE SHORT_URL=?', [linkToDelete]) #Delete the statistics
return "OK" #response is only for ajax request
except:
abort(500)
abort(500) #return internal server error, if something fails
if (__name__ == "__main__"):
print("This file is not made fore direct call, please run the main.py")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment