forked from release-engineering/pubtools-pulplib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove type_id from search_content API
There's no need for type_id to be a separate argument to this API; we've already documented content_type_id as a field on our Unit classes, so let's make it possible to search for that field using a Criteria, just like other documented fields. Although this costs some extra code to deal with _content_type_id internally, this is likely worthwhile due to: - more consistent API; callers filter on content_type_id like any other field, rather than having to remember that type_id is passed as a regular argument while all other fields are passed via criteria. - fits better with some upcoming proposed features; a Criteria.for_units(...) has been proposed as a method of searching for units matching given instances of Unit classes. It would not make sense to force a caller to pass a type_id in that case, when the given Units already know their own type_id. Note also that validate_type_ids was removed, because it's OK to omit type_id altogether (which means search for all types), and it's OK to search for types not currently known by this library (which will be returned as just plain Unit instances).
- Loading branch information
Showing
7 changed files
with
229 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.