doncatnip/kanone — Issue #2: Unicode problem when using Len validator
Author: nikitinsm
Created: 2012-01-16 08:53:34+00:00
State: open

*the code*

```python
s2 = (
't1', String() & Len(max=9),
)

s = Schema(
*s2
)

c2 = {
't1': u'Скушай яблоко',
}

c = s.context(c2)

```

Traceback (most recent call last):
File "utils.py", line 94, in
result = c.result
File "build/bdist.linux-x86_64/egg/kanone/lib.py", line 222, in result
return self.validate()
File "build/bdist.linux-x86_64/egg/kanone/lib.py", line 331, in validate
result = self.validator.validate( self, self.__value__)
File "build/bdist.linux-x86_64/egg/kanone/validator/core.py", line 116, in validate
return self.on_value( context, value )
File "build/bdist.linux-x86_64/egg/kanone/validator/schema.py", line 69, in on_value
return self.on_value( context, value )
File "build/bdist.linux-x86_64/egg/kanone/validator/schema.py", line 174, in _createContextChilds_on_value
res = context( key ).result
File "build/bdist.linux-x86_64/egg/kanone/lib.py", line 222, in result
return self.validate()
File "build/bdist.linux-x86_64/egg/kanone/lib.py", line 334, in validate
self.error = e
File "build/bdist.linux-x86_64/egg/kanone/lib.py", line 250, in error
extra['value'] = str(value)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)