def del_thread(thread_id): try: g.user.username if str(thread_id) not in g.user.get_threads(): abort(401) except AttributeError: abort(401) if request.method == "POST": t = Thread(redis=g.r, user=g.user) t.load(thread_id) t.delete() flash(u'Deleted thread.', 'success') return redirect(url_for('frontend.inbox')) else: return render_template('confirm.html', _message='Are you sure you wish to DELETE this thread?', _ok=url_for('frontend.del_thread', thread_id=thread_id), _cancel=url_for('frontend.inbox') )
def del_thread(thread_id): try: g.user.username if str(thread_id) not in g.user.get_threads(): abort(401) except AttributeError: abort(401) if request.method == "POST": t = Thread(redis=g.r, user=g.user) t.load(thread_id) t.delete() flash(u'Deleted thread.', 'success') return redirect(url_for('frontend.inbox')) else: return render_template( 'confirm.html', _message='Are you sure you wish to DELETE this thread?', _ok=url_for('frontend.del_thread', thread_id=thread_id), _cancel=url_for('frontend.inbox'))