mansam/validator.py — pull request #4 by warmspringwinds (2014-08-03 13:51:07+00:00)
Title: StopOnError feature

I had a problem with `validator.py` recently when I tried to apply this rule:
`rule = {"name":"name": [InstanceOf(basestring), Length(5)]}`
In my tests there was a tested input value:
`dictionary = {"name": 5}`
When I ran my tests, an exception was raised stating that `int doesn't have len()`
This was caused because `validator.py` proceeded to check this field after `InstanceOf(basestring)`.

I think that this behaviour isn't desirable in some cases.
I propose to add `StopOnError` keyword that will prevent the behaviour: all validations will be stoped
in case of error.
`validation = {"name": [StopOnError, InstanceOf(basestring), Length(5)]}` will be executed without exception and only the first error message will be in the output.