Ñò †°Ic @ s< d Z d d k Z d d k Z d d k Z d d k Z y d d k l Z Wn e j o d Z n Xd d d d d d g Z d d k Z d „ Z d d e ƒ d „ Z e ƒ d „ Z d d d „ ƒ YZ d „ Z d e f d „ ƒ YZ d e i f d „ ƒ YZ d e f d „ ƒ YZ e ƒ Z d e f d „ ƒ YZ d S( s Core classes for validation. iÿÿÿÿN( t resource_filenamet NoDefaultt Invalidt Validatort Identityt FancyValidatort is_validatorc C sê d } t d j o- y t t d ƒ } Wq@ t j o q@ Xn t t d ƒ p t i i t i i t ƒ d ƒ St i | t i t i Bƒ o | St i i t i i t ƒ d ƒ } t i | t i t i Bƒ p t i i 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. t s /i18nt accesst i18ns /usr/share/localeN( R t Nonet __name__t NotImplementedErrort hasattrt ost patht joint dirnamet __file__R t R_OKt X_OKt normpath( t locale_dir( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyt get_localedir s !t FormEncodec C s1 t i d | d | d | d t ƒ } | i a d S( Nt domaint languagest localedirt fallback( t gettextt translationt Truet ugettextt _stdtrans( R R R t t( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyt set_stdtranslation2 s c C s | S( N( ( t s( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyt _= s c B s e Z RS( ( R t __module__( ( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyR C s c C s- t | t ƒ p t | t ƒ o t | t ƒ S( N( t isinstanceR t typet issubclass( t obj( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyR F s c B sA e Z d Z d d d „ Z d „ Z d „ Z e d d d „ Z RS( 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. c C sA t i | | ƒ | | _ | | _ | | _ | | _ | | _ d S( N( t Exceptiont __init__t msgt valuet statet error_listt error_dict( t selfR- R. R/ R0 R1 ( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyR, f s c C s | i } | S( N( R- ( R2 t val( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyt __str__s s c C sP t | i t ƒ o | i St | i t ƒ o | i i d ƒ St | i ƒ Sd S( Nt utf8( R' R- t unicodet strt decode( R2 ( ( s2 /usr/lib/python2.6/site-packages/formencode/api.pyt __unicode__y s t .t -c C s- | i oJ g } x<