Re: Unclear behaviour of formencode.Schema with UnicodeString items

2011-02-12 Thread Ian Wilson
Not really, I think you have a point. If it is inconvenient to extend the existing string validators then the addition of a new more web form friendly string validator sounds like a good idea. On Fri, Feb 11, 2011 at 9:53 AM, Maxim Avanov wrote: > Thanks for the snippet above, Ian. > > > What ou

Re: Unclear behaviour of formencode.Schema with UnicodeString items

2011-02-11 Thread Maxim Avanov
Thanks for the snippet above, Ian. > What outcome do you actually want? Only the first or last thing from the > list to get validated? Or an error if there is more than one thing ? I think the validator must raise an exception in such a case. I'm going to create a ticket in the formencode's tra

Re: Unclear behaviour of formencode.Schema with UnicodeString items

2011-02-10 Thread Ian Wilson
After thinking about this more it would probably be better if UnicodeString just had a parameter that turned coercion of everything but instances of basestring and None off. Or maybe another validator was created that did that. It makes more sense for the validator that is assigned that key to re

Re: Unclear behaviour of formencode.Schema with UnicodeString items

2011-02-10 Thread Maxim Avanov
Hi, Ian. Thanks for reply. >If you want to be EXTRA strict then you could try ConfirmType and >UnicodeString combined in an All validator to catch this error. Or something >to that effect. This solution will work, but I wouldn't like to use it for several reasons. First of all, we already have

Re: Unclear behaviour of formencode.Schema with UnicodeString items

2011-02-08 Thread Ian Wilson
Hi, I think this behavior happens because mixed is used here https://bitbucket.org/ianb/formencode/src/d95237b33f3c/formencode/api.py#cl-403. If you don't want that to happen ever then I think you need to cast params to a regular dictionary, with something like dict(request.params.items()). This w

Unclear behaviour of formencode.Schema with UnicodeString items

2011-02-08 Thread Maxim Avanov
Here's an example. # = from formencode import Schema, Invalid from formencode.validators import UnicodeString, Int from webob import Request class StrictSchema(Schema): allow_extra_fields = False class IntegerTestSchema(StrictSchema): testfield = Int(not_empty=True)