I'm not quite sure if what I'm about to discuss is what you're asking
so correct me if I'm wrong.  A trailing comma will sometimes create a
tuple depending on the context which doesn't have much to do with
formencode.  Ha also yes that comma thing has happened to me.  The
company attribute is receiving a tuple instead of String.

This should demonstrate this:
>>> x = 1,2
>>> x
(1, 2)
>>> x = 1
>>> x
1
>>> x = 1,
>>> x
(1,)

A trailing comma creates a tuple with a single item in it.

-Ian

On Wed, Feb 10, 2010 at 12:47 AM, Tomasz Narloch <[email protected]> wrote:
> Have you ever happened to you?
>
> My example:
>
> class GoodUserForm(FancyValidator):
>   def validate_python(self, value, state):
>       errors = {}
>       [...]
>       try:
>           String(not_empty=True, min=2).to_python(value['company']) # raise
> KeyError
>       except formencode.Invalid, e:
>           errors.update({'company': unicode(e)})
>       [...]
>
>
> class UserFormUpdate(formencode.Schema):
>   allow_extra_fields = True
>
>   individual = StringBool(if_missing=False, if_empty=False)
>   [...]
>   company = String(max=128, if_missing=None, strip=True), # <-- The error is
> a comma!!!, but I can create pyc and use it
>   [...]
>   chained_validators = [GoodUserForm()]
>
> This file can be compile, but it is not works as expected.
>
> Best Regards,
> Tomasz Narloch
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/pylons-discuss?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to