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

Fix Maximum number of Iterations Exceeded when no catalogs set for AT type #2422

Merged
merged 4 commits into from
Nov 14, 2023

Conversation

Lunga001
Copy link
Contributor

Description of the issue/feature this PR addresses

On the bika api in function get_catalogs_for , the variable catalogs is expected to be a list that can be iterated on but it returns None if we add a custom content type on our add-on

Current behavior before PR

catalogs = archetype_tool.catalog_map.get(portal_type) is None and

catalogs = filter(None, map(lambda cid: get_tool(cid, None), catalogs))
goes into Maximum number of Iterations Exceeded error if catalogs is None

Desired behavior after PR is merged

Catalogs should be an empty list if the tool(portal_type) is not found
catalogs = archetype_tool.catalog_map.get(portal_type) or []

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

@Lunga001 Lunga001 marked this pull request as ready for review November 14, 2023 08:58
@xispa xispa changed the title Return list if catalog is not found instead of None Fix Maximum number of Iterations Exceeded when no catalogs set for AT type Nov 14, 2023
Copy link
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lunga001 just a request to make the changelog cleaner!

CHANGES.rst Outdated Show resolved Hide resolved
@xispa xispa merged commit d2f3993 into senaite:2.x Nov 14, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants