mò +á¸Ec@sdZdkZdklZlZdklZdklZdkl Z dk l Z l Z l Z lZlZedZdZed Zd Zd klZd ed ƒd„ZeeƒZdfd„ƒYZxWeiƒeiƒD]?\ZZeeƒejoeeƒZnee eeƒqæWeoadk l!Z!xQe!iƒD]?\ZZeeƒejoeeƒZnee eeƒqJWnyedk"l#Z#dk$l%Z%l&Z&l'Z'dk(Z(dfd„ƒYZ)dfd„ƒYZ*e)ƒe _(Wne+j onXgZ,e,d„Z-d„Z.e-e _/e.e _0d„Z1e1e _1d„Z2e2e _2de fd„ƒYZ3ei4dei5ƒi6Z7dfd „ƒYZ8d!„Z9d d d"dd#„Z:d$Z;egƒZ<dd ei4d%ƒei4d&ƒei4d'ƒei4d(ƒd)„Z>dS(*sDDTML Utilities $Id: DT_Util.py 40320 2005-11-22 16:08:56Z tseaver $N(s html_quotesustr(s safe_builtins(sutility_builtins(sRestrictionCapableEval(s InstanceDicts TemplateDicts render_blockss safe_callables join_unicodettestitstrsDocument Template Parse Error(s UnauthorizeditcCsl|i||ƒ}|oHyt|ƒ}Wqa||}t|tƒot|ƒ}q]qaXn|pdS(Ni( tparamstgettnametdefaulttvtinttmdt isinstanceR(RR RRtstR((t7/data/zmath/zope/lib/python/DocumentTemplate/DT_Util.pyt int_param#s t NotBindablecBstZd„ZRS(NcCs ||_dS(N(tftselft__call__(RR((R t__init__1s(t__name__t __module__R(((R R/s(slimited_builtins(s TaintedString(s FunctionTypesBuiltinFunctionTypes StringTypetStringModuleWrappercBstZd„ZRS(NcCsEtt|ƒ}t|tƒpt|tƒot|ƒSn|SdS(N(tgetattrtstringtkeytattrR t FunctionTypetBuiltinFunctionTypetStringFunctionWrapper(RRR((R t __getattr__Hs (RRR(((R RGsRcBstZd„Zd„ZRS(NcCs ||_dS(N(tmethodRt_method(RR((R RQscOsþd}t|ƒ}xLtt|ƒƒD]8}t||tƒod}t||ƒ||Expression (Python) Syntax error:
%s
isTThe "..." shorthand for expr was used in a tag that doesn't support expr attributes.sTwo %s values were givens No %s given(RRSRTttagReRRURR%t ParseErrorRBt SyntaxErrorR/R( RRfReRtdefault_unnamedRTRURR((R t name_paramàsF   5           sæ Python expression support Several document template tags, including 'var', 'in', 'if', 'else', and 'elif' provide support for using Python expressions via an 'expr' tag attribute. Expressions may be used where a simple variable value is inadequate. For example, an expression might be used to test whether a variable is greater than some amount:: or to transform some basic data:: Objects available in the document templates namespace may be used. Subobjects of these objects may be used as well, although subobject access is restricted by the optional validation method. In addition, a special additional name, '_', is available. The '_' variable provides access to the document template namespace as a mapping object. This variable can be useful for accessing objects in a document template namespace that have names that are not legal Python variable names:: This variable also has attributes that provide access to standard utility objects. These attributes include: - The objects: 'None', 'abs', 'chr', 'divmod', 'float', 'hash', 'hex', 'int', 'len', 'max', 'min', 'oct', 'ord', 'pow', 'round', and 'str' from the standard Python builtin module. - Special security-aware versions of 'getattr' and 'hasattr', - The Python 'string', 'math', and 'random' modules, and - A special function, 'test', that supports if-then expressions. The 'test' function accepts any number of arguments. If the first argument is true, then the second argument is returned, otherwise if the third argument is true, then the fourth argument is returned, and so on. If there is an odd number of arguments, then the last argument is returned in the case that none of the tested arguments is true, otherwise None is returned. For example, to convert a value to lower case:: s([- ]*([^- ="]+))s([- ]*("[^"]*"))s([- ]*([^- ="]+)=([^- ="]+))s([- ]*([^- ="]+)="([^"]*)")cKsÕ|ph}|i|ƒ} |i|ƒ}|i|ƒ} |i|ƒ} | o=| i dƒi ƒ} | i dƒ}t| i dƒƒ} n–|o=|i dƒi ƒ} |i dƒ}t|i dƒƒ} nR| o®| i dƒ} t| i dƒƒ} |oa|i| ƒo:|| d jotd| |f‚n|| || R:RARBtcompiletIRmt simple_nameRYRcRjtExpr_docR~R/Rz(*RcR3RAR:RˆRR„RR™RYR-RR€RŒRŠRBRRšR RR2RR4RRgR'R‹RR8R~RjRzR6R†RR‚R@RRR“RR((R t?sh    %              $ 69