def contained(self, container, filters=None, limit=None, offset=None, order_by=None, **kwargs): """ Returns non-subcontainer objects within `container`. """ filter_to_inside_container = self._get_filter_for_contained(container, self.contained_class) filters = base.munge_lists(filter_to_inside_container, filters) return self.contained_manager.list(filters=filters, limit=limit, offset=offset, order_by=order_by, **kwargs)
def subcontainers(self, container, filters=None, limit=None, offset=None, order_by=None, **kwargs): """ Returns only the containers within `container`. """ filter_to_inside_container = self._get_filter_for_contained(container, self.subcontainer_class) filters = base.munge_lists(filter_to_inside_container, filters) # TODO: collections.DatasetCollectionManager doesn't have the list # return self.subcontainer_manager.list( filters=filters, limit=limit, offset=offset, order_by=order_by, **kwargs ) return self._session().query(self.subcontainer_class).filter(filters).all()