def change_pending_status(): if Security.is_login(SK): callback = request.form['callback'] try: Invoice.change_pending_status(request.form['pending_id']) except Exception as e: print(e) return 'Failed' return redirect(url_for(callback)) return redirect(url_for('login', callback=stack()[0][3]))