Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
url_shorter_docker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Leder
url_shorter_docker
Commits
17721413
Commit
17721413
authored
5 years ago
by
Jonas Leder
Browse files
Options
Downloads
Patches
Plain Diff
documentation
parent
0111ece5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#236
passed
5 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
deletelink.py
+4
-4
4 additions, 4 deletions
deletelink.py
with
4 additions
and
4 deletions
deletelink.py
+
4
−
4
View file @
17721413
...
...
@@ -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
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment