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 Item #37

Closed
5 of 14 tasks
digitaldogsbody opened this issue May 13, 2022 · 3 comments · Fixed by #81
Closed
5 of 14 tasks

Add Item #37

digitaldogsbody opened this issue May 13, 2022 · 3 comments · Fixed by #81
Assignees
Labels
helper Helper method to be added
Projects

Comments

@digitaldogsbody
Copy link
Member

digitaldogsbody commented May 13, 2022

Description

This helper takes a reference to an appropriate object (e.g for a Collection, it would accept a Collection or a Manifest) and adds it to the end of the items property

Function name / Parameters / Return

Function name: .add_item(item)

Parameters: item - the Prezi3 objetc to be added

Returns: None

Objects

  • Base Object (all Prezi3 Classes)
  • Collection
  • Manifest
  • Canvas
  • Range
  • AnnotationCollection
  • AnnotationPage
  • Annotation
  • Content Resource - Image
  • Content Resource - Video
  • Content Resource - Text
  • Service
  • Provider
  • Other - please list below

Considerations

Different objects will have different acceptable inputs (i.e you can't add a Manifest to a Canvas object's items), so this should be validated by the helper code.

@digitaldogsbody digitaldogsbody added the helper Helper method to be added label May 13, 2022
@glenrobson
Copy link
Contributor

For collection be aware of:

https://github.com/iiif-prezi/iiif-prezi3/blob/main/iiif_prezi3/helpers/collection_add_methods.py

It would be useful if a user can use this method for a collection and pass in a full Manifest and the method should convert it into a reference.

Main use for other classes is to add the item and return the reference to the one that is added into the class:

self.items.append(manifestref)
return manifestref

AnnotationPage -> annotationCollection is always a reference

@digitaldogsbody
Copy link
Member Author

digitaldogsbody commented May 20, 2022

Considerations:

  • Adding Manifest to a Collection must add a reference rather than embedding the object (see considerations in Make Manifest #42)
  • Allow Pydantic's error handling to deal with invalid assignments (e.g manifest -> canvas items)
  • After adding item (using items.append(<x>)), use object.items = object.items to force Pydantic to revalidate

@digitaldogsbody digitaldogsbody self-assigned this May 20, 2022
@glenrobson glenrobson added this to In progress in Hackathon May 27, 2022
@glenrobson glenrobson linked a pull request Oct 7, 2022 that will close this issue
@glenrobson
Copy link
Contributor

Discussed in meeting all done.

Hackathon automation moved this from In progress to Done Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
helper Helper method to be added
Projects
Development

Successfully merging a pull request may close this issue.

2 participants