ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ Rc@sdZddlZddlmZddlmZddlmZmZm Z m Z m Z m Z m Z mZdZeddd d d gZed d dgZeddgZeseZnddlZejddeddddlmZefZefZefZyGddlmZmZddl m Z eeef7Zee f7ZWne!k rpnXy!ddl"m#Z#ee#f7ZWne!k rnXyGddlm$Z$m%Z%m&Z&ee$f7Zee%f7Zee&f7ZWne!k rnXee'ddddddd d!gfee'ddd"d#d!gfee'd$d%d&d'd(dgfee'd$d)dd(d*dd+dd,g ffZ(d-Z)d.Z*d/Z+d0Z,d1efd2YZ-d3e-fd4YZ.dS(5sj jinja2.sandbox ~~~~~~~~~~~~~~ Adds a sandbox layer to Jinja as it was the default behavior in the old Jinja 1 releases. This sandbox is slightly different from Jinja 1 as the default behavior is easier to use. The behavior can be changed by subclassing the environment. :copyright: (c) 2010 by the Jinja Team. :license: BSD. iN(t Environment(t SecurityError(t string_typest function_typet method_typettraceback_typet code_typet frame_typetgenerator_typetPY2it func_closuret func_codet func_dictt func_defaultst func_globalstim_classtim_functim_selftgi_frametgi_codetignoresthe sets moduletmodulesjinja2.sandbox(tdeque(tUserDictt DictMixin(tUserList(tSet(t MutableSettMutableMappingtMutableSequencetaddtcleartdifference_updatetdiscardtpoptremovetsymmetric_difference_updatetupdatetpopitemt setdefaulttappendtreversetinserttsorttextendt appendleftt extendlefttpoplefttrotatecGs5t|}t|tkr1tdtn|S(sWA range that can't generate ranges with a length of more than MAX_RANGE items. s+range too big, maximum size for range is %d(trangetlent MAX_RANGEt OverflowError(targstrng((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyt safe_range`s   cCs t|_|S(snMarks a function or method as unsafe. :: @unsafe def delete(self): pass (tTruetunsafe_callable(tf((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytunsafeks cCst|tr"|tkrtSnt|trP|tksI|tkrtSn`t|trr|dkrtSn>t|ttt frtSt|t r|t krtSn|j dS(s Test if the attribute given is an internal python attribute. For example this function returns `True` for the `func_code` attribute of python objects. This is useful if the environment method :meth:`~SandboxedEnvironment.is_safe_attribute` is overridden. >>> from jinja2.sandbox import is_internal_attribute >>> is_internal_attribute(lambda: None, "func_code") True >>> is_internal_attribute((lambda x:x).func_code, 'co_code') True >>> is_internal_attribute(str, "upper") False tmrot__( t isinstanceRtUNSAFE_FUNCTION_ATTRIBUTESR8RtUNSAFE_METHOD_ATTRIBUTESttypeRRRRtUNSAFE_GENERATOR_ATTRIBUTESt startswith(tobjtattr((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytis_internal_attributexs      cCs4x-tD]%\}}t||r||kSqWtS(sThis function checks if an attribute on a builtin mutable object (list, dict, set or deque) would modify it if called. It also supports the "user"-versions of the objects (`sets.Set`, `UserDict.*` etc.) and with Python 2.6 onwards the abstract base classes `MutableSet`, `MutableMapping`, and `MutableSequence`. >>> modifies_known_mutable({}, "clear") True >>> modifies_known_mutable({}, "keys") False >>> modifies_known_mutable([], "append") True >>> modifies_known_mutable([], "index") False If called with an unsupported object (such as unicode) `False` is returned. >>> modifies_known_mutable("foo", "upper") False (t _mutable_specR>tFalse(RDREttypespecR;((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytmodifies_known_mutablestSandboxedEnvironmentcBseZdZeZiejd6ejd6ejd6ej d6ej d6ej d6ej d6Z iejd6ejd6ZeZeZdZd Zd Zd Zd Zd ZdZdZdZdZRS(sThe sandboxed environment. It works like the regular environment but tells the compiler to generate sandboxed code. Additionally subclasses of this environment may override the methods that tell the runtime what attributes or functions are safe to access. If the template tries to access insecure code a :exc:`SecurityError` is raised. However also other exceptions may occour during the rendering so the caller has to ensure that all exceptions are catched. t+t-t*t/s//s**t%cCstS(sCalled during template compilation with the name of a unary operator to check if it should be intercepted at runtime. If this method returns `True`, :meth:`call_unop` is excuted for this unary operator. The default implementation of :meth:`call_unop` will use the :attr:`unop_table` dictionary to perform the operator with the same logic as the builtin one. The following unary operators are interceptable: ``+`` and ``-`` Intercepted calls are always slower than the native operator call, so make sure only to intercept the ones you are interested in. .. versionadded:: 2.6 (RH(tselftoperator((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytintercept_unopscOsHtj|||t|jd<|jj|_|jj|_dS(NR1( Rt__init__R7tglobalstdefault_binop_tabletcopyt binop_tabletdefault_unop_tablet unop_table(RQR5tkwargs((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyRTs cCs|jdpt|| S(sYThe sandboxed environment will call this method to check if the attribute of an object is safe to access. Per default all attributes starting with an underscore are considered private as well as the special attributes of internal python objects as returned by the :func:`is_internal_attribute` function. t_(RCRF(RQRDREtvalue((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytis_safe_attribute scCs#t|dtp!t|dt S(sCheck if an object is safely callable. Per default a function is considered safe unless the `unsafe_callable` attribute exists and is True. Override this method to alter the behavior, but this won't affect the `unsafe` decorator from this module. R9t alters_data(tgetattrRH(RQRD((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytis_safe_callablescCs|j|||S(sFor intercepted binary operator calls (:meth:`intercepted_binops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6 (RX(RQtcontextRRtlefttright((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyt call_binopscCs|j||S(sFor intercepted unary operator calls (:meth:`intercepted_unops`) this function is executed instead of the builtin operator. This can be used to fine tune the behavior of certain operators. .. versionadded:: 2.6 (RZ(RQRbRRtarg((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyt call_unop'scCsy ||SWnttfk rt|tryt|}Wntk rTqXyt||}Wntk r{qX|j|||r|S|j ||SqnX|j d|d|S(s(Subscribe an object from sandboxed code.RDtname( t TypeErrort LookupErrorR>Rtstrt ExceptionR`tAttributeErrorR^tunsafe_undefinedt undefined(RQRDtargumentRER]((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytgetitem0s    cCsyt||}Wn7tk rLy ||SWqvttfk rHqvXn*X|j|||rf|S|j||S|jd|d|S(sSubscribe an object from sandboxed code and prefer the attribute. The attribute passed *must* be a bytestring. RDRh(R`RmRiRjR^RnRo(RQRDt attributeR]((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyR`Es  cCs/|jd||jjfd|d|dtS(s1Return an undefined object for unsafe attributes.s.access to attribute %r of %r object is unsafe.RhRDtexc(Rot __class__t__name__R(RQRDRr((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyRnVs cOs8|j|s%td|fn|j|||S(s#Call an object from sandboxed code.s%r is not safely callable(RaRtcall(t_SandboxedEnvironment__selft_SandboxedEnvironment__contextt_SandboxedEnvironment__objR5R[((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyRv^s(Rut __module__t__doc__R8t sandboxedRRRtsubtmulttruedivtfloordivtpowtmodRVtpostnegRYt frozensettintercepted_binopstintercepted_unopsRSRTR^RaReRgRqR`RnRv(((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyRKs2                 tImmutableSandboxedEnvironmentcBseZdZdZRS(sWorks exactly like the regular `SandboxedEnvironment` but does not permit modifications on the builtin mutable objects `list`, `set`, and `dict` by using the :func:`modifies_known_mutable` function. cCs*tj||||stSt|| S(N(RKR^RHRJ(RQRDRER]((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyR^ms(RuRzR{R^(((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pyRgs(/R{RRtjinja2.environmentRtjinja2.exceptionsRtjinja2._compatRRRRRRRR R3tsetR?R@RBtwarningstfilterwarningstDeprecationWarningt collectionsRt_mutable_set_typestdictt_mutable_mapping_typestlistt_mutable_sequence_typesRRRt ImportErrortsetsRRRRRRGR7R;RFRJRKR(((s?/opt/alt/python27/lib/python2.7/site-packages/jinja2/sandbox.pytsj :