def addcard(tuid): lib = LibManager() user = UserManager() uid = session["uid"] result = "false" if user.hasUid(tuid) and not lib.hasCard(uid, tuid): if lib.addCard(uid, tuid): result = "true" return result
def delcard(tuid): lib = LibManager() user = UserManager() uid = session["uid"] result = "false" if user.hasUid(tuid) and lib.hasCard(uid, tuid): if lib.deleteCard(uid, tuid): result = "true" return result
def hascard(tuid): if tuid == 0: return "false" lib = LibManager() return json.dumps(lib.hasCard(session["uid"], tuid))
def index(): lib = LibManager() cards = lib.getCards(session["uid"]) print cards return render_template("index.html", cards=cards)