Closed felipedau closed 7 years ago
Hi @david415 and @meejah, I read attrs' docs and picked one of unMessage's classes to use it. Contact
seemed to be a good one as it has optional attributes, typed attributes and validated attributes. The changes are in 9fceaa1d424e6bcac1a5cf7b45ae92cc5e13e367.
I chose to make type validation in the validator methods because I wanted it to raise the specific Invalid<Attr>Error
, instead of TypeError
.
P.S. I also saw that attrs has a nice way to represent instances for serializing, so that will help a lot when dealing with the file element, for example.
Let me know what you think.
Thanks!
I am closing this as most of unMessage's classes have now been created with attrs. In some cases it was not possible so I opened #50 and #51.
Feedback from @david415 suggested the use of attrs to simplify the code, make it more concise, etc.