Exemple #1
0
    def get_conversations(self, limit=10, offset=0):
        """UNUSED - Get conversations for current User object

        Returns:
         A list of Conversation objects
        """

        c = Conversation.query(self.username_norm in Conversation.receivers, keys_only=True)\
        .order(Conversation.modified)\
        .limit(limit, offset=offset)
        return ndb.get_multi(c)
Exemple #2
0
    def get_conversations(self, limit=10, offset=0):
        """UNUSED - Get conversations for current User object

        Returns:
         A list of Conversation objects
        """

        c = Conversation.query(self.username_norm in Conversation.receivers, keys_only=True)\
                        .order(Conversation.modified)\
                        .limit(limit, offset=offset)
        return ndb.get_multi(c)
Exemple #3
0
    def get_conversations_for(cls, username, offset, limit):
        """Gets conversations for user with username

        Returns:
         A list of Conversation objects for username
        """
        limit = int(limit) if limit else 10
        offset = int(offset) if offset else 0

        c = Conversation.query(Conversation.receivers_list_norm.IN([username.lower()]))\
        .order(-Conversation.modified)\
        .fetch(limit=limit, offset=offset, keys_only=True)
        return ndb.get_multi(c)
Exemple #4
0
    def get_conversations_for(cls, username, offset, limit):
        """Gets conversations for user with username

        Returns:
         A list of Conversation objects for username
        """
        limit = int(limit) if limit else 10
        offset = int(offset) if offset else 0

        c = Conversation.query(Conversation.receivers_list_norm.IN([username.lower()]))\
                        .order(-Conversation.modified)\
                        .fetch(limit=limit, offset=offset, keys_only=True)
        return ndb.get_multi(c)