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

Attempt to Address Issue-225 and Issue-226. #227

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

Conversation

markpbaggett
Copy link
Member

@markpbaggett markpbaggett commented Jan 20, 2025

What Does This Do?

This makes MakeCollection create a Collection when there are items or a CollectionRef when there are not. It also pops items on data for MakeManifest so that we don't accidentally end up with an embedded Manifest. This is needed due to an issue with Reference and extra.allow.

@markpbaggett markpbaggett marked this pull request as ready for review January 23, 2025 20:17


class MakeCollection:

def make_collection(self, **kwargs):
"""Create a Collection.
"""Creates a Collection or CollectionRef.

Creates a new collection, adds it to the calling Collection `items`
and returns the newly created object. Accepts keyword arguments to
customize the resulting instance.
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

We should update the description to mention if you don't pass in items then it creates a CollectionRef.

How easy is it to convert a CollectionRef to Collection? If a user doesn't pass items then tries to add it later will this cause an error? Should we have two methods, make_collection and make_collection_ref to make it more explicit?

@markpbaggett
Copy link
Member Author

@glenrobson, you are right. If this comes in and someone did this:

j = collection.make_collection(
    id="https://example.com/collection/2",
    label="No props with items",
)
j.make_manifest(
    id="https://example.com/collection/2",
)
print(j)

You're going to get an error since make_manifest() doesn't exist on CollectionRef. Let's go with your idea for two different helpers.

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.

2 participants