marrow/marrow.tags — pull request #1 by adrien-f (2014-05-07 20:42:35+00:00)
Title: Validations

Added validation basics to marrow.tags. You can now implement the validate method on widgets to add different rules. The Input widget comes with required and pattern support but it is easy to add your own requirements.

### Usage

Input widget example:
```python
test_required_input = Input(type_='text', name_='test', required=True)
test_input = Input(type_='text', name_='test', pattern=r'\w+')
```

Own input widget example:
```python

class MyInput(Input):
def validate(self, data):
super(Input, self).validate(data) # Optional but does the required and pattern check
value = data.get(self.name, None)
if value != 'The value it needs to be':
raise ValidationError('The value is not what it should be !')
```