[Zope3-dev] Re: Sequence Validation

Garrett Smith garrett at mojave-corp.com
Tue Jun 8 18:59:28 EDT 2004


> The fields (for example IList ) all use _validate_sequence for the validation
> of the items.
> This method loops through the items :
> 
>     for item in value:
>         error = None
>         try:
>             value_type.validate(item)
>         except ValidationError, error:
>             pass
>         else:
>             # We validated, so clear error (if any) and done with
>             # this value
>             error = None
>             break
> 
>         if error is not None:
>             errors.append(error)
> 
> 
> Why does the loop break, if one correct item was found ?
> This way if the first Item is correct and all other items are not, the 
> validation succeeds anyway. This is not, what I would have expected...
> 
> Feature or Bug ?

Bug.

I've fixed this and will checkin the change later tonight. (Currently 
running tests and have to go play firsbee now).

  -- Garrett




More information about the Zope3-dev mailing list