Ñò †°Ic @ s¾ d Z d d k Z e i Z e i d e ƒ d d k l Z e e _ y e Wn e j o e Z n Xd d k l Z l Z d d k l Z l Z l Z d g Z d e f d „ ƒ YZ d S( s Validator for repeating items. iÿÿÿÿNt ignore( t Set( t NoDefaultt Invalid( t CompoundValidatort to_pythont from_pythont ForEachc B sc e Z d Z e Z e Z e Z d Z d „ Z d „ Z d e f d „ ƒ YZ e ƒ Z [ d „ Z RS( s Use this to apply a validator/converter to each item in a list. For instance:: ForEach(AsInt(), InList([1, 2, 3])) Will take a list of values and try to convert each of them to an integer, and then check if each integer is 1, 2, or 3. Using multiple arguments is equivalent to:: ForEach(All(AsInt(), InList([1, 2, 3]))) Use convert_to_list=True if you want to force the input to be a list. This will turn non-lists into one-element lists, and None into the empty list. This tries to detect sequences by iterating over them (except strings, which aren't considered sequences). ForEach will try to convert the entire list, even if errors are encountered. If errors are encountered, they will be collected and a single Invalid exception will be raised at the end (with error_list set). If the incoming value is a set, then we return a set. c C s³ | i o | i | ƒ } n | i t j o | o | i S| i oF | o> | t j o | i o g St | i d | ƒ | | ƒ ‚ n g } g } t } t | t t f ƒ } | d j o7 t | d t ƒ } t | d t ƒ } d } | | _ n z.x³ | D]« } | o | | _ | d 7} n t } xY | i D]N } y | | | | ƒ } Wq6t j o# } | i | ƒ t } t } Pq6Xq6W| o | i d ƒ n | i | ƒ qW| o | o t | ƒ } n | St d d i g } | D] } | o | t | ƒ qëqë~ ƒ | | d | ƒ‚ Wd | d j ox | t j o$ y | ` Wqpt j o qpXn | | _ | t j o$ y | ` Wqªt j o qªXq®| | _ n Xd S( Nt emptyt indext full_listi i s Errors: %ss t error_list( t convert_to_listt _convert_to_listt if_emptyR t not_emptyR t accept_pythonR t messaget Truet isinstancet setR t Nonet getattrR R t validatorst appendt Falset joint unicodet AttributeError( t selft valuet statet validatet new_listt errorst all_goodt is_sett previous_indext previous_full_listR t sub_valuet good_passt validatort et _[1]( ( s6 /usr/lib/python2.6/site-packages/formencode/foreach.pyt attempt_convert4 sx < c C s g S( N( ( R R ( ( s6 /usr/lib/python2.6/site-packages/formencode/foreach.pyt empty_valuet s t _IfMissingc B s&