def index_student(room_name, role): if not Room.exists(room_name): return redirect(url_for("app.index_room")) elif role not in ["student", "assistant"]: return redirect(url_for("app.index_role")) return render_template("{}.html".format(role))
def addroom(name, password, description): if name is "": print("Error: Name is empty") return if password is "": print("Warning: Password is empty") with app.app_context(): if Room.exists(name): print("Error: Room {} already exists".format(name)) return Room.add(name=name, password=password, description=description) print("Success: Room {} added".format(name))
def index_role(room_name): if not Room.exists(room_name): return redirect(url_for("app.index_room")) return render_template("index_role.html") # Choice of role