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

Add get_parents and get_closed_parent functions #560

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open

Conversation

rohnsha0
Copy link

@rohnsha0 rohnsha0 commented Feb 19, 2025

closes #531


📚 Documentation preview 📚: https://ploneapi--560.org.readthedocs.build/

@rohnsha0 rohnsha0 requested a review from davisagli February 19, 2025 18:19
@mister-roboto
Copy link

@rohnsha0 thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@stevepiercy
Copy link
Contributor

@rohnsha0 this PR will need tests and docs, per https://6.docs.plone.org/plone.api/contribute.html

@rohnsha0
Copy link
Author

@stevepiercy Ik, I'll do it today 😅

@rohnsha0 rohnsha0 requested a review from ale-rt February 20, 2025 13:12
@rohnsha0 rohnsha0 requested a review from stevepiercy February 20, 2025 14:11
Copy link
Member

@ale-rt ale-rt left a comment

Choose a reason for hiding this comment

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

You are not actually getting the "parents" but the ancestors.

@rohnsha0
Copy link
Author

You are not actually getting the "parents" but the ancestors.

Okay, so how would I get that!? I'm unsure of the same! @ale-rt

@ale-rt
Copy link
Member

ale-rt commented Feb 20, 2025

@rohnsha0 the tests are failing, you have already been suggested to work on your editing tool.

Before pushing, please:

  • be sure that pre-commit passes
  • be sure the test pass

Please read: https://6.docs.plone.org/plone.api/contribute.html

@rohnsha0 rohnsha0 requested a review from ale-rt February 20, 2025 17:32
@rohnsha0
Copy link
Author

not sure, why the tests are now failing!

@rohnsha0 rohnsha0 requested a review from davisagli February 21, 2025 02:28
@stevepiercy
Copy link
Contributor

You are not actually getting the "parents" but the ancestors.

Okay, so how would I get that!? I'm unsure of the same! @ale-rt

@rohnsha0 I think @ale-rt was suggesting to replace the string parent with ancestor throughout the code, docs, and news item. Before you do that, let's get his confirmation. "Ancestor" is a more generic term than "parent", and includes parents, grandparents, great-greatparents, and further ancestors up the hierarchy.

@ale-rt
Copy link
Member

ale-rt commented Feb 21, 2025

@rohnsha0 I think @ale-rt was suggesting to replace the string parent with ancestor throughout the code, docs, and news item. Before you do that, let's get his confirmation. "Ancestor" is a more generic term than "parent", and includes parents, grandparents, great-greatparents, and further ancestors up the hierarchy.

Thanks @stevepiercy 🥇

@rohnsha0
Copy link
Author

@jenkins-plone-org please run jobs

Comment on lines 694 to 702
filtered_chain = []
for parent in chain:
try:
if predicate(parent):
filtered_chain.append(parent)
except WorkflowException:
# Skip objects that raise WorkflowException
continue
chain = filtered_chain
Copy link
Member

Choose a reason for hiding this comment

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

Also this change does not make any sense to... it was already good as it was before...

Copy link
Author

Choose a reason for hiding this comment

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

If not handled here, it raises WorkflowException. The change ig is needeed

Copy link
Member

@ale-rt ale-rt Feb 23, 2025

Choose a reason for hiding this comment

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

If not handled here, it raises WorkflowException. The change ig is needeed

Not really, the code of this function should be agnostic of the predicate internals.

Copy link
Author

Choose a reason for hiding this comment

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

uhm, then documenting that predicates should handle their own exceptions, would be workaround? @ale-rt

Copy link
Member

Choose a reason for hiding this comment

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

Why did you mark this conversation as resolved why it is not. This does not help getting your work merged.
I would not even document that, IMO it is obvious.

Copy link
Author

Choose a reason for hiding this comment

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

Why did you mark this conversation as resolved why it is not.

I pushed the changes. I thought my question about that doesn't matter now since I just documented it. Still sorry @ale-rt. Wasn't intended.

This does not help getting your work merged.

Ik, thanks! Marking a convo resolved doesn't relate to getting work merged! If the code is useful then it'll be merged else closed. Simple!
But was just done coz I thought I've made the changes so it's not relevant. Which ig was wrong. Bt please don't take it elsewhere.

@rohnsha0 rohnsha0 requested a review from ale-rt February 23, 2025 19:25
@ale-rt
Copy link
Member

ale-rt commented Feb 24, 2025

Please @rohnsha0, before continuing check how the conversation ere develops: #531 (comment)

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 this pull request may close these issues.

Add api.content.get_parents
5 participants