Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
def get_user(username):
    if username in SESSION_CACHE:
        return SESSION_CACHE[username]
    return ChatUser.get_user(username)
Exemplo n.º 4
0
 def get_user(self, username):
     if username in self:
         return self[username]
     return ChatUser.get_user(username)
Exemplo n.º 5
0
def get_user(username):
    if username in SESSION_CACHE:
        return SESSION_CACHE[username]
    return ChatUser.get_user(username)
Exemplo n.º 6
0
 def get_user(self,username):
     if username in self:
         return self[username]
     return ChatUser.get_user(username)