def unwatch_from_email(payload): from www.helpers import redirect_url s = security.get_serializer() try: (identifier, email) = s.loads(payload) print (identifier, email) except BadSignature: abort(404) Watch.objects(identifier=identifier, watchers__email=email).update_one(set__watchers__S__watching=False) flash("You have been unsubscribed from any future price alerts on that flight.", 'warning') return redirect(redirect_url())
def app_errorhandler(error): #response = jsonify(error.to_dict()) #response.status_code = error.status_code flash(message=error.message, category=error.category) response = make_response(redirect(redirect_url())) return response