Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(namespace): Remove the intermediary
_Namespace
model
Abstract ======== Remove the `_Namespace` model, and use `self` as field type when calling `optional_field` for the `Namespace.namespace` field. Motivation ========== Using the intermediary model `_Namespace` was a hack to be able to pass a defined model as field type to `optional_field` for the `Namespace.namespace` field. Rationale ========= The `instance_of` validator of the `attrs` package takes a type. But by subclassing it and using the class from the field instance at validation time, it was possible to create our own validator (via the `instance_of_self` function, or passing `self` to `optional_field` and `required_field)`.
- Loading branch information
Showing
2 changed files
with
46 additions
and
38 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