Пример #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")
Пример #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")
Пример #3
0
def get_user(username):
    if username in SESSION_CACHE:
        return SESSION_CACHE[username]
    return ChatUser.get_user(username)
Пример #4
0
 def get_user(self, username):
     if username in self:
         return self[username]
     return ChatUser.get_user(username)
Пример #5
0
def get_user(username):
    if username in SESSION_CACHE:
        return SESSION_CACHE[username]
    return ChatUser.get_user(username)
Пример #6
0
 def get_user(self,username):
     if username in self:
         return self[username]
     return ChatUser.get_user(username)