예제 #1
0
def remove_recipe(recipe_id, session_key):
    userid = __get_userid_from_key(session_key)
    recipe_id = int(recipe_id)
    if not __recipe_in_inventory(recipe_id, userid):
        kwlog.log("Recipe not in inventory")
        return False
    else:
        if MySQL.remove_all_items_from_recipe(recipe_id):
            kwlog.log("removed all items")
            if __remove_recipe_from_db(recipe_id):
                kwlog.log("recipe removed from DB")
                return True
            else:
                kwlog.log("could not remove recipe")
                return False
        else:
            kwlog.log("failed to remove all items")
            return False