Ñò †°Ic @s¾dZddkZeiZeideƒddklZee_yeWnej o eZnXddk l Z l Z ddk l Z lZlZdgZde fd„ƒYZdS( s Validator for repeating items. iÿÿÿÿNtignore(tSet(t NoDefaulttInvalid(tCompoundValidatort to_pythont from_pythontForEachcBsceZdZeZeZeZdZd„Z d„Z de fd„ƒYZ e ƒZ [ d„ZRS(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. cCs³|io|i|ƒ}n|itj o| o|iS|ioF| o>|tjo|iogSt|id|ƒ||ƒ‚ng}g}t }t |t t fƒ}|dj o7t|dtƒ}t|dtƒ} d} ||_nz.x³|D]«} |o| |_| d7} nt } xY|iD]N} y|| | |ƒ} Wq6tj o#}|i|ƒt}t} Pq6Xq6W| o|idƒn|i| ƒqW|o|ot |ƒ}n|Stddig}|D]}|o|t|ƒqëqë~ƒ||d|ƒ‚Wd|dj ox|tjo$y |`Wqptj oqpXn ||_| tjo$y |`Wqªtj oqªXq®| |_nXdS( Ntemptytindext full_listiis Errors: %ss t error_list(tconvert_to_listt_convert_to_listtif_emptyRt not_emptyRt accept_pythonRtmessagetTruet isinstancetsetRtNonetgetattrR R t validatorstappendtFalsetjointunicodetAttributeError(tselftvaluetstatetvalidatetnew_listterrorstall_goodtis_settprevious_indextprevious_full_listR t sub_valuet good_passt validatortet_[1]((s6/usr/lib/python2.6/site-packages/formencode/foreach.pytattempt_convert4sx       <         cCsgS(N((RR((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyt empty_valuetst _IfMissingcBs&eZdd„Zd„Zd„ZRS(cCs5|djogS|itijogS|iSdS(N(Rt _if_missingR(Rtobjttype((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyt__get__xs  cCs ||_dS(N(R/(RR0R((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyt__set__scCs t|_dS(N(RR/(RR0((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyt __delete__sN(t__name__t __module__RR2R3R4(((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyR.ws  cCsƒt|ttfƒo|gS|djogSt|ttfƒo|Syx|D]}PqUW|SWntj o |gSXdS(N(RtstrRRtlistttuplet TypeError(RRtn((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyR ‡s ((R5R6t__doc__RR RRt repeatingR/R,R-tobjectR.t if_missingR (((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyRs @  (R<twarningstfilterst simplefiltertDeprecationWarningtsetsRRt NameErrortapiRRtcompoundRRRt__all__R(((s6/usr/lib/python2.6/site-packages/formencode/foreach.pyts