示例#1
0
 def get_lists(self, limit=1000, offset=0, sort=True):
     q = {"type": "/type/list", "seeds": self.get_seed(), "limit": limit, "offset": offset}
     keys = web.ctx.site.things(q)
     lists = web.ctx.site.get_many(keys)
     if sort:
         lists = h.safesort(lists, reverse=True, key=lambda list: list.last_modified)
     return lists
示例#2
0
    def get_lists(self, seed=None, limit=100, offset=0, sort=True):
        """Returns all the lists of this user.
        
        When seed is specified, this returns all the lists which contain the
        given seed.
        
        seed could be an object or a string like "subject:cheese".
        """
        q = {
            "type": "/type/list",
            "key~": self.key + "/lists/*",
            "limit": limit,
            "offset": offset
        }
        if seed:
            if isinstance(seed, Thing):
                seed = {"key": seed.key}
            q['seeds'] = seed

        keys = self._site.things(q)
        lists = self._site.get_many(keys)
        if sort:
            lists = h.safesort(lists,
                               reverse=True,
                               key=lambda list: list.last_update)
        return lists
示例#3
0
 def _get_lists(self, limit=50, offset=0, sort=True):
     q = {"type": "/type/list", "seeds": {"key": self.key}, "limit": limit, "offset": offset}
     keys = self._site.things(q)
     lists = self._site.get_many(keys)
     if sort:
         lists = h.safesort(lists, reverse=True, key=lambda list: list.last_update)
     return lists
示例#4
0
    def _get_lists(self, limit=50, offset=0, sort=True):
        # cache the default case
        if limit == 50 and offset == 0:
            keys = self._get_lists_cached()
        else:
            keys = self._get_lists_uncached(limit=limit, offset=offset)

        lists = self._site.get_many(keys)
        if sort:
            lists = h.safesort(lists, reverse=True, key=lambda list: list.last_modified)
        return lists
示例#5
0
    def _get_lists(self, limit=50, offset=0, sort=True):
        # cache the default case
        if limit == 50 and offset == 0:
            keys = self._get_lists_cached()
        else:
            keys = self._get_lists_uncached(limit=limit, offset=offset)

        lists = self._site.get_many(keys)
        if sort:
            lists = h.safesort(lists, reverse=True, key=lambda list: list.last_modified)
        return lists
示例#6
0
 def get_lists(self, limit=1000, offset=0, sort=True):
     q = {
         "type": "/type/list",
         "seeds": self.get_seed(),
         "limit": limit,
         "offset": offset
     }
     keys = web.ctx.site.things(q)
     lists = web.ctx.site.get_many(keys)
     if sort:
         lists = h.safesort(lists, reverse=True, key=lambda list: list.last_modified)
     return lists
示例#7
0
 def _get_lists(self, limit=50, offset=0, sort=True):
     q = {
         "type": "/type/list",
         "seeds": {
             "key": self.key
         },
         "limit": limit,
         "offset": offset
     }
     keys = self._site.things(q)
     lists = self._site.get_many(keys)
     if sort:
         lists = h.safesort(lists,
                            reverse=True,
                            key=lambda list: list.last_update)
     return lists
示例#8
0
    def get_lists(self, seed=None, limit=100, offset=0, sort=True):
        """Returns all the lists of this user.

        When seed is specified, this returns all the lists which contain the
        given seed.

        seed could be an object or a string like "subject:cheese".
        """
        # cache the default case
        if seed is None and limit == 100 and offset == 0:
            keys = self._get_lists_cached()
        else:
            keys = self._get_lists_uncached(seed=seed, limit=limit, offset=offset)

        lists = self._site.get_many(keys)
        if sort:
            lists = h.safesort(lists, reverse=True, key=lambda list: list.last_modified)
        return lists
示例#9
0
    def get_lists(self, seed=None, limit=100, offset=0, sort=True):
        """Returns all the lists of this user.

        When seed is specified, this returns all the lists which contain the
        given seed.

        seed could be an object or a string like "subject:cheese".
        """
        # cache the default case
        if seed is None and limit == 100 and offset == 0:
            keys = self._get_lists_cached()
        else:
            keys = self._get_lists_uncached(seed=seed, limit=limit, offset=offset)

        lists = self._site.get_many(keys)
        if sort:
            lists = h.safesort(lists, reverse=True, key=lambda list: list.last_modified)
        return lists
示例#10
0
    def get_lists(self, seed=None, limit=100, offset=0, sort=True):
        """Returns all the lists of this user.
        
        When seed is specified, this returns all the lists which contain the
        given seed.
        
        seed could be an object or a string like "subject:cheese".
        """
        q = {"type": "/type/list", "key~": self.key + "/lists/*", "limit": limit, "offset": offset}
        if seed:
            if isinstance(seed, Thing):
                seed = {"key": seed.key}
            q["seeds"] = seed

        keys = self._site.things(q)
        lists = self._site.get_many(keys)
        if sort:
            lists = h.safesort(lists, reverse=True, key=lambda list: list.last_update)
        return lists