def get(self): if authenticate(self.request): _json = {"rooms": [], "users": []} for user in ChatUser.getall(): _json["users"].append({ "username": user.username, "status": user.username in SESSION_CACHE }) for room_id, room in SESSION_CACHE.get_active_rooms(): _json["rooms"].append({"room_id": room_id}) self.write(serialize(_json)) else: self.set_status(403, "Invalid session, please login")
def get(self): if authenticate(self.request): _json = { "rooms":[], "users":[] } for user in ChatUser.getall(): _json["users"].append({ "username":user.username, "status":user.username in SESSION_CACHE }) for room_id,room in SESSION_CACHE.get_active_rooms(): _json["rooms"].append({ "room_id":room_id }) self.write(serialize(_json)) else: self.set_status(403,"Invalid session, please login")
def get_user(username): if username in SESSION_CACHE: return SESSION_CACHE[username] return ChatUser.get_user(username)
def get_user(self, username): if username in self: return self[username] return ChatUser.get_user(username)
def get_user(self,username): if username in self: return self[username] return ChatUser.get_user(username)