mò &á¸Ec@s¿dZdklZdklZlZdklZdkl Z dk l Z de fd„ƒYZ dfd „ƒYZ d k lZlZd klZd eefd „ƒYZdd„ZdS(s¬Zope-specific Python Expression Handler Handler for Python expressions that uses the RestrictedPython package. $Id: ZRPythonExpr.py 68333 2006-05-29 10:34:19Z philikon $ (s safe_builtins(sguarded_getattrsget_safe_globals(scompile_restricted_eval(s CompilerError(s PythonExprt PythonExprcBs7tZeƒZeed|i}|i|hƒ}|i|iƒt|i |hƒS(N( RRt__traceback_info__t_bind_used_namestecontexttvarstupdatet_globalstevalR(RRRR((Rt__call__'s (t__name__t __module__tget_safe_globalsRtguarded_getattrRRR(((RRs     t_SecureModuleImportercBstZeZd„ZRS(NcCsGtd|ƒ}|idƒ}x!|dD]}t||ƒ}q*W|S(Nt __import__t.i(t safe_builtinstmoduletmodtsplittpathRtgetattr(RR(RR+R)((Rt __getitem__0s  (R R!tTruet*__allow_access_to_unprotected_subobjects__R-(((RR$-s(s TemplateDicts InstanceDict(sRestrictedDTMLtRtdcBstZdZRS(N(R R!tNonetthis(((RR09sicCs³tƒ}|id|idƒƒ}||_|idhƒ}|i|ƒ|it|i|ƒƒ|i|ƒz,|djo|d|ƒSn ||ƒSWd|i dƒXdS(Ntcontexttheretrequestii( R0ttdtnstgetR2R5t_pusht InstanceDicttargtfR1t_pop(R<R7R;R2R5R6((Rt call_with_ns<s     N(t__doc__t AccessControlR'tAccessControl.ZopeGuardsR#R"tRestrictedPythonR tzope.tales.talest CompilerErrortzope.tales.pythonexprRR$tDocumentTemplate.DT_Utilt TemplateDictR:tAccessControl.DTMLtRestrictedDTMLR0R>( R"R>R R0RGR'R#RRDR$RIR:((Rt?s