예제 #1
0
    def getRoomsByUser(cls, user):
        """ Will return the chat rooms created by the requested user """
        userID = str(user['id'])
        index = IndexByUser().get()

        if not index.has_key(userID):
            return []
        return index[userID]
예제 #2
0
파일: helpers.py 프로젝트: arturodr/indico
    def getNumberOfRoomsByUser(cls, user, exclude=None):
        """ Will return the number of rooms that the user has in this index,
            can exclude a conference if passed through by exclude param.
        """
        userID = str(user['id'])
        index = IndexByUser().get()

        if not index.has_key(userID):
            return 0

        idx = index[userID].values()

        if exclude is not None:
            idx = DBHelpers()._filterIndexExclusion(idx, exclude)

        return len(idx)
예제 #3
0
파일: helpers.py 프로젝트: sylvestre/indico
    def getNumberOfRoomsByUser(cls, user, exclude=None):
        """ Will return the number of rooms that the user has in this index,
            can exclude a conference if passed through by exclude param.
        """
        userID = str(user['id'])
        index = IndexByUser().get()

        if not index.has_key(userID):
            return 0

        idx = index[userID].values()

        if exclude is not None:
            idx = DBHelpers()._filterIndexExclusion(idx, exclude)

        return len(idx)
예제 #4
0
파일: helpers.py 프로젝트: arturodr/indico
    def getRoomsByUser(cls, user, offset=0, limit=None, exclude=None):
        """ Will return the chat rooms created by the requested user """
        userID = str(user['id'])
        index = IndexByUser().get()

        if not index.has_key(userID):
            return []

        idx = index[userID].values()

        if exclude is not None:
            idx = DBHelpers()._filterIndexExclusion(idx, exclude)

        if offset >= len(idx): # If we have gone over the boundaries
            return []

        limit = limit if limit is not None else (len(index[userID]) - 1)
        limit += offset

        return list(idx[offset:limit])
예제 #5
0
파일: helpers.py 프로젝트: sylvestre/indico
    def getRoomsByUser(cls, user, offset=0, limit=None, exclude=None):
        """ Will return the chat rooms created by the requested user """
        userID = str(user['id'])
        index = IndexByUser().get()

        if not index.has_key(userID):
            return []

        idx = index[userID].values()

        if exclude is not None:
            idx = DBHelpers()._filterIndexExclusion(idx, exclude)

        if offset >= len(idx): # If we have gone over the boundaries
            return []

        limit = limit if limit is not None else (len(index[userID]) - 1)
        limit += offset

        return list(idx[offset:limit])