def view(book_ident): ident = int(book_ident) book = get_book(ident) return render_template("view.html", book=book, cart=get_cart(), purchased=get_purchases())
def recommendations(): recs = get_recommendations() # sorted list of recs if len(recs) > 50: raise ValueError('get_recommendations returned list with > 50 books') return render_template("recommendations.html", books=recs, cart=get_cart(), purchased=get_purchases())
def search(): query = request.form['query'] res = search_books(query) # list of matching books if len(res) > 50: raise ValueError('search_books returned list with > 50 books') return render_template('search.html', books=res, query=query, cart=get_cart(), purchased=get_purchases())
def show_cart(): return render_template('cart.html', books=get_cart(), cart=get_cart(), purchased=get_purchases())
def home(): return render_template('index.html', books=get_book_dict(), cart=get_cart(), purchased=get_purchases())