def delete(): username = request.get_cookie("username", settings.cookie_secret) password = request.get_cookie("password", settings.cookie_secret) ok = api.check(username, password) if ok: meeting_id = request.params.get("meeting_id") if username in settings.admins: api.remove(meeting_id) else: info = api.get_meeting_info(meeting_id) if username in info.get("moderator_users"): api.remove(meeting_id) redirect("/start")
def edit(): username = request.get_cookie("username", settings.cookie_secret) password = request.get_cookie("password", settings.cookie_secret) ok = api.check(username, password) if ok: username = username.lower() if request.method == "GET": meeting_id = request.params.get("meeting_id") info = api.get_meeting_info(meeting_id) if username not in info.get("moderator_users") and username not in settings.admins: redirect("/start") users = api.suggest("") # username = username.lower() # if username in users: # users.remove(username) attendee_users = info.get("attendee_users") if "" in info.get("attendee_users"): attendee_users.remove("") attendee_users = [x.strip() for x in attendee_users] # remove start/end space if username not in attendee_users: attendee_users.append(username) info["attendee_users"] = attendee_users users = [x for x in users if x not in attendee_users] return jinja2_template("edit.html", users=users, info=info) else: meeting_id = request.params.get("meeting_id") name = request.params.get("name") attendee_users = request.params.get("attendee_users").split(",") attendee_users = [x.strip() for x in attendee_users if x != ""] api.update(username, meeting_id, name, attendee_users) redirect("/start")