def get_list(self, blist_id): if not self.lists.contains_id(blist_id): return None bookmark_list = BookmarkList(my_id=blist_id, redis=self.redis, access=self.access) bookmark_list.owner = self if not self.access.can_read_list(bookmark_list): return None return bookmark_list
def create_bookmark_list(self, props): self.access.assert_can_write_coll(self) bookmark_list = BookmarkList(redis=self.redis, access=self.access) bookmark_list.init_new(self, props) before_blist = self.get_list(props.get('before_id')) self.lists.insert_ordered_object(bookmark_list, before_blist) slug = self.get_list_slug(props.get('title')) if slug: self.list_names.add_object(slug, bookmark_list) return bookmark_list
def get_list(self, blist_id): """Return list of bookmarks. :param str blist_id: list ID :returns: list of bookmarks :rtype: BookmarkList or None """ if not self.lists.contains_id(blist_id): return None bookmark_list = BookmarkList(my_id=blist_id, redis=self.redis, access=self.access) bookmark_list.owner = self if not self.access.can_read_list(bookmark_list): return None return bookmark_list
def create_bookmark_list(self, props): """Create list of bookmarks. :param dict props: properties :returns: list of bookmarks :rtype: BookmarkList """ self.access.assert_can_write_coll(self) bookmark_list = BookmarkList(redis=self.redis, access=self.access) bookmark_list.init_new(self, props) before_blist = self.get_list(props.get('before_id')) self.lists.insert_ordered_object(bookmark_list, before_blist) slug = self.get_list_slug(props.get('title')) if slug: self.list_names.add_object(slug, bookmark_list) return bookmark_list