model: implement specialized attribute-validator functions
This should reduces function calls and speeds things up.
It might be useful to introduce even more specialized validator in the
future. It would also be useful to skip the intermediate try/except.
Some of this will be done in later changesets.