aboutsummaryrefslogtreecommitdiff
path: root/pastebin.py
diff options
context:
space:
mode:
Diffstat (limited to 'pastebin.py')
-rw-r--r--pastebin.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/pastebin.py b/pastebin.py
index 4c529f9..3851d01 100644
--- a/pastebin.py
+++ b/pastebin.py
@@ -48,6 +48,13 @@ def url_for_other_page(page):
app.jinja_env.globals['url_for_other_page'] = url_for_other_page
app.jinja_env.globals['appname'] = app.config['APPNAME']
+def refresh_string(delay,url):
+ """
+ Returns a string for html content for redirecting the user back after the
+ requested delay, to the requested url.
+ """
+ return f'<meta http-equiv="Refresh" content="{delay}; url={url}">'
+
@app.before_request
def check_user_status():
g.user = None
@@ -148,9 +155,10 @@ def delete_paste(paste_id):
try:
Paste.query.filter(Paste.id == paste.id).delete()
db.session.commit()
- return "OK",200 # WORKHERE: make this and the 500 redirect to admin/
+ message = refresh_string(1, url_for("admin")) + "OK"
+ return message,200
except:
- return "failure to delete object.",500
+ return f"failure to delete object. Select <a href='{url_for('admin')}'>here</a> to return to the admin panel.",500
def get_all_pastes():
"""
bgstack15