Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_all_collections only goes one level deeper #1360

Closed
387809109 opened this issue Jul 5, 2024 · 1 comment · Fixed by #1361
Closed

get_all_collections only goes one level deeper #1360

387809109 opened this issue Jul 5, 2024 · 1 comment · Fixed by #1361

Comments

@387809109
Copy link

I was trying to call get_all_collections to recursively get all collections within a root catalog. It turned out that only collections of the root catalog and its direct children are returned.

Looking at the code

def get_all_collections(self) -> Iterable[Collection]:

def get_all_collections(self) -> Iterable[Collection]:
    """Get all collections from this catalog and all subcatalogs. Will traverse
    any subcatalogs recursively."""
    yield from self.get_collections()
    for child in self.get_children():
        yield from child.get_collections()

It seems that it's expected to only return collections from self and children.

Is it intentional or a bug?

@jsignell
Copy link
Member

jsignell commented Jul 5, 2024

That looks like a bug to me. I think that second yield should be child.get_all_collections(). I can open a PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants