soveran/scrivener — pull request #5 by foca (2012-07-07 19:34:45+00:00)
Title: Typed attributes

The idea is that models should receive "proper objects", and shouldn't handle typecasting. I think typecasting is a responsibility to which scrivener is well suited.

With this in mind I added this code.

There's two things I'm not convinced about:

1. Calling the methods `cleaned_blah`. I didn't want to go full-out and change how the default attribute getter works, since this would break backwards compatibility, so I added this extra method. I don't like the name a lot, but it's what django/bureaucrat use, so I thought it was good enough.
2. The fact that the .parse implementations might raise TypeError, and that's unhandled. This should probably be handled to add a validation error.

Thoughts?