Ñò †°Ic@s<dZddkZddkZddkZddkZyddklZWnej o dZnXdddddd gZ ddk Z d „Z d de ƒd „Z e ƒd „Z ddd„ƒYZd„Zdefd„ƒYZdeifd„ƒYZdefd„ƒYZeƒZdefd„ƒYZdS(s Core classes for validation. iÿÿÿÿN(tresource_filenamet NoDefaulttInvalidt ValidatortIdentitytFancyValidatort is_validatorcCsêd}tdj o-yttdƒ}Wq@tj oq@Xnttdƒp tiitiit ƒdƒSti |ti ti Bƒo|Stiitiit ƒdƒ}ti |ti ti Bƒptii dƒ}n|S(sÞ Retrieve the location of locales. If we're built as an egg, we need to find the resource within the egg. Otherwise, we need to look for the locales on the filesystem or in the system message catalog. ts/i18ntaccessti18ns/usr/share/localeN(RtNonet__name__tNotImplementedErrorthasattrtostpathtjointdirnamet__file__RtR_OKtX_OKtnormpath(t locale_dir((s2/usr/lib/python2.6/site-packages/formencode/api.pyt get_localedirs   !t FormEncodec Cs1tid|d|d|dtƒ}|iadS(Ntdomaint languagest localedirtfallback(tgettextt translationtTruetugettextt _stdtrans(RRRtt((s2/usr/lib/python2.6/site-packages/formencode/api.pytset_stdtranslation2scCs|S(N((ts((s2/usr/lib/python2.6/site-packages/formencode/api.pyt_=scBseZRS((R t __module__(((s2/usr/lib/python2.6/site-packages/formencode/api.pyRCscCs-t|tƒpt|tƒo t|tƒS(N(t isinstanceRttypet issubclass(tobj((s2/usr/lib/python2.6/site-packages/formencode/api.pyRFscBsAeZdZddd„Zd„Zd„Zeddd„ZRS(s£ This is raised in response to invalid input. It has several public attributes: msg: The message, *without* values substituted. For instance, if you want HTML quoting of values, you can apply that. substituteArgs: The arguments (a dictionary) to go with `msg`. str(self): The message describing the error, with values substituted. value: The offending (invalid) value. state: The state that went with this validator. This is an application-specific object. error_list: If this was a compound validator that takes a repeating value, and sub-validator(s) had errors, then this is a list of those exceptions. The list will be the same length as the number of values -- valid values will have None instead of an exception. error_dict: Like `error_list`, but for dictionary compound validators. cCstti||ƒ||_||_||_||_||_|i p(|i ptd||i|if‚dS(NsIErrors shouldn't have both error dicts and lists (error %s has %s and %s)(t Exceptiont__init__tmsgtvaluetstatet error_listt error_dicttAssertionError(tselfR-R.R/R0R1((s2/usr/lib/python2.6/site-packages/formencode/api.pyR,fs     cCs |i}|S(N(R-(R3tval((s2/usr/lib/python2.6/site-packages/formencode/api.pyt__str__ss cCsPt|itƒo|iSt|itƒo|iidƒSt|iƒSdS(Ntutf8(R'R-tunicodetstrtdecode(R3((s2/usr/lib/python2.6/site-packages/formencode/api.pyt __unicode__ys t.t-c Csc|ion| p td‚|i pt‚g}x<|iD]1}|p|i|ƒq>|i|iƒƒq>W|S|ioÄh}xQ|iiƒD]@\}}t|ttfƒo|||R?tresulttitemtnameRCtkey((s2/usr/lib/python2.6/site-packages/formencode/api.pyRAs>          N( R R&t__doc__R R,R5R:RERA(((s2/usr/lib/python2.6/site-packages/formencode/api.pyRKs   cBs’eZdZhZeZeZeZhZ e Z dZ d„Z d„Zdd„Zdd „Zd „Zd „Zd „Zd „ZeeƒZRS(s’ The base class of most validators. See `IValidator` for more, and `FancyValidator` for the more common (and more featureful) class. t to_pythont from_pythontmessaget all_messagest subvalidatorscCsM|idƒo/|iiƒ|_|ii|iƒ|`n|iƒdS(Ntmessages(thas_keyt _messagestcopytupdateRRt_initialize_docstring(tclst new_attrs((s2/usr/lib/python2.6/site-packages/formencode/api.pyt __classinit__Ás  cOs[|idƒo1|iiƒ|_|ii|dƒ|d=ntii|||ŽdS(NRR(RSRTRURVt declarativet DeclarativeR,(R3targstkw((s2/usr/lib/python2.6/site-packages/formencode/api.pyR,Ès  cCs|S(N((R3R.R/((s2/usr/lib/python2.6/site-packages/formencode/api.pyRMÏscCs|S(N((R3R.R/((s2/usr/lib/python2.6/site-packages/formencode/api.pyRNÒsc Ksy |i}Wn\tj oPy-|ioddk}|i}nt}Wqltj o t}qlXnXt|ƒp t}n|i|}|||i}y ||SWnRtj oF}td|||ii |ƒ|di |ii ƒƒfƒ‚nXdS(Niÿÿÿÿs-Key not found (%s) for %r=%r %% %r (from: %s)s, ( R%tAttributeErrortuse_builtins_gettextt __builtin__R!tcallableRTt gettextargstKeyErrortgetRRF(R3tmsgNameR/R^ttransRaR-te((s2/usr/lib/python2.6/site-packages/formencode/api.pyROÕs*         cCs½|iiƒ}x§|iƒD]™}|iƒ}x„|D]|\}}||joY|||joq5nt||tƒo||i|ƒq±|||g||s.           d{