removed debugs, reply with 200 OK instead of redirect that is ignored anyway

This commit is contained in:
2021-01-06 23:31:19 +11:00
parent 9617186279
commit cc8d8c30c1
2 changed files with 8 additions and 11 deletions

6
README
View File

@@ -32,6 +32,9 @@ MAYBE-1: when moving a book in a series (which is part of 2 series), do we pop-u
#### TODOS (next 22):
TODO-5: should deleting really just ask if want to mark it as SOLD?
TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book)
TODO-22: adding a sub-book when the parent book is in a series, need to add a bsl for it and make it the next (probably)
TODO-8: show books on shelf list
TODO-9: show books to buy view / printable
TODO-11: show unrated books (with toggle to exclude those with missing in a series)
@@ -47,7 +50,6 @@ TODO-18: consider which of the 'books maybe not valid' reports make sense still
TODO-19: icons on wish list, etc.? (not sure I really want them, but if so)
- wishlist: search-dollar OR https://www.flaticon.com/free-icon/wishlist_868517
- save: https://www.flaticon.com/free-icon/sold_463255?term=sold&page=1&position=6&related_item_id=463255
TODO-20: ORM all books load is slow
- should I lazy load all books (ajax the 2nd->last pages in, or not use ORM, and do a quick db.execute()....)
TODO-21: allow a way to add a book as a child of another existing book (opposite of rem_sub_book)
TODO-22: adding a sub-book when the parent book is in a series, need to add a bsl for it and make it the next (probably)

13
main.py
View File

@@ -1,4 +1,4 @@
from flask import Flask, render_template, request, redirect
from flask import Flask, render_template, request, redirect, jsonify
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.exc import SQLAlchemyError
from flask_marshmallow import Marshmallow
@@ -588,9 +588,7 @@ def rem_books_from_loan(id):
except SQLAlchemyError as e:
st.SetAlert("danger")
st.SetMessage("Failed to remove books from loan! -- {}".format( e.orig ))
print ("NOT SURE WHAT TO DO if we dont want output" )
return redirect("/loan/{}".format(id))
return jsonify(success=True)
@app.route("/add_books_to_loan/<id>", methods=["POST"])
def add_books_to_loan(id):
@@ -603,9 +601,7 @@ def add_books_to_loan(id):
except SQLAlchemyError as e:
st.SetAlert("danger")
st.SetMessage("Failed to add books to loan! -- {}".format( e.orig ))
print ("NOT SURE WHAT TO DO if we dont want output" )
return redirect("/loan/{}".format(id))
return jsonify(success=True)
@app.route("/rem_parent_books_from_series/<pid>", methods=["POST"])
def rem_parent_books_from_series(pid):
@@ -617,8 +613,7 @@ def rem_parent_books_from_series(pid):
except SQLAlchemyError as e:
st.SetAlert("danger")
st.SetMessage("Failed to delete parent & sub books from ALL series! -- {}".format( e.orig ))
print ("NOT SURE WHAT TO DO if we dont want output - can we just return a 200?" )
return redirect("/")
return jsonify(success=True)
@app.route("/", methods=["GET"])
def main_page():