ó
    ½Rj„  ã                   óJ   • S r SSKrSSKJr  SSKJr  SSKJr   " S S\5      rg)	z‹
Wrapper class that takes a list of template loaders as an argument and attempts
to load templates from them in order, caching the result.
é    N)ÚTemplateDoesNotExist)Úcopy_exceptioné   )ÚLoaderc                   ó`   ^ • \ rS rSrU 4S jrS rS rSU 4S jjrS rSS jr	S r
S	 rS
rU =r$ )r   é   c                 ó^   >• 0 U l         UR                  U5      U l        [        TU ]  U5        g ©N)Úget_template_cacheÚget_template_loadersÚloadersÚsuperÚ__init__)ÚselfÚenginer   Ú	__class__s      €ÚJD:\diplom_project\venv\Lib\site-packages\django/template/loaders/cached.pyr   ÚLoader.__init__   s*   ø€ Ø"$ˆÔØ×2Ñ2°7Ó;ˆŒÜ‰Ñ˜Õ ó    c              #   óŒ   #   • U R                    H.  n[        US5      (       d  M  UR                  5        S h  v•N   M0     g  N	7f)NÚget_dirs)r   Úhasattrr   )r   Úloaders     r   r   ÚLoader.get_dirs   s3   é € Ø—l”lˆFÜ�v˜z×*Ó*Ø!Ÿ?™?Ó,×,Ò,ò #á,ùs   ‚A¥A¸A¹
Ac                 ó8   • UR                   R                  U5      $ r
   )r   Úget_contents)r   Úorigins     r   r   ÚLoader.get_contents   s   € Ø�}‰}×)Ñ)¨&Ó1Ð1r   c                 óê  >• U R                  X5      nU R                  R                  U5      nU(       aT  [        U[        5      (       a  [        U[        5      (       a  U" U5      e[        U[        5      (       a  [        U5      eU$  [        TU ]%  X5      nXPR                  U'   U$ ! [         a?  nU R                  R                  (       a  [        U5      O[        U R                  U'   e SnAff = f)a’  
Perform the caching that gives this loader its name. Often many of the
templates attempted will be missing, so memory use is of concern here.
To keep it in check, caching behavior is a little complicated when a
template is not found. See ticket #26306 for more details.

With template debugging disabled, cache the TemplateDoesNotExist class
for every missing template and raise a new instance of it after
fetching it from the cache.

With template debugging enabled, a unique TemplateDoesNotExist object
is cached for each missing template to preserve debug data. When
raising an exception, Python sets __traceback__, __context__, and
__cause__ attributes on it. Those attributes can contain references to
all sorts of objects up the call chain and caching them creates a
memory leak. Thus, unraised copies of the exceptions are cached and
copies of those copies are raised after they're fetched from the cache.
N)Ú	cache_keyr   ÚgetÚ
isinstanceÚtypeÚ
issubclassr   r   r   Úget_templater   Údebug)r   Útemplate_nameÚskipÚkeyÚcachedÚtemplateÚer   s          €r   r%   ÚLoader.get_template   sÖ   ø€ ð& �n‰n˜]Ó1ˆØ×(Ñ(×,Ñ,¨SÓ1ˆÞÜ˜&¤$×'Ñ'¬J°vÔ?S×,TÑ,TÙ˜]Ó+Ð+Ü˜FÔ$8×9Ñ9Ü$ VÓ,Ð,ØˆMð	4Ü‘wÑ+¨MÓ@ˆHð ,4×#Ñ# CÑ(àˆøô $ó 	à%)§[¡[×%6×%6”˜qÔ!Ô<Pð ×#Ñ# CÑ(ð ûð		ús   Â
B) Â)
C2Â3:C-Ã-C2c              #   óh   #   • U R                    H  nUR                  U5       S h  v•N   M     g  N	7fr
   )r   Úget_template_sources)r   r'   r   s      r   r/   ÚLoader.get_template_sourcesD   s*   é € Ø—l”lˆFØ×2Ñ2°=ÓA×AÒAò #ÙAùs   ‚$2¦0§
2c                 óî   • SnU(       aE  U Vs/ s H   oDR                   U:X  d  M  UR                  PM"     nnU(       a  U R                  U5      nSR                  S [	        U5      U4 5       5      $ s  snf )a*  
Generate a cache key for the template name and skip.

If skip is provided, only origins that match template_name are included
in the cache key. This ensures each template is only parsed and cached
once if contained in different extend chains like:

    x -> a -> a
    y -> a -> a
    z -> a -> a
Ú Ú-c              3   ó6   #   • U  H  o(       d  M  Uv •  M     g 7fr
   © )Ú.0Úss     r   Ú	<genexpr>Ú#Loader.cache_key.<locals>.<genexpr>]   s   é € ÐJÒ#D˜aËŸ™Ò#Dùs   ‚
�	)r'   ÚnameÚgenerate_hashÚjoinÚstr)r   r'   r(   Úskip_prefixr   Úmatchings         r   r    ÚLoader.cache_keyH   sr   € ð ˆæá*.óÚ*. ×2FÑ2FÈ-Ñ2W“�—”©$ð ð ö Ø"×0Ñ0°Ó:�à�x‰xÑJ¤C¨Ó$6¸Ñ#DÓJÓJÐJùòs
   ŽA2¥A2c                 ó„   • [         R                  " SR                  U5      R                  5       5      R	                  5       $ )NÚ|)ÚhashlibÚsha1r<   ÚencodeÚ	hexdigest)r   Úvaluess     r   r;   ÚLoader.generate_hash_   s,   € Ü�|Š|˜CŸH™H VÓ,×3Ñ3Ó5Ó6×@Ñ@ÓBÐBr   c                 ó8   • U R                   R                  5         g)zEmpty the template cache.N)r   Úclear)r   s    r   ÚresetÚLoader.resetb   s   € à×Ñ×%Ñ%Õ'r   )r   r   r
   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   r   r   r%   r/   r    r;   rK   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r      s4   ø† õ!ò
-ò
2÷&òPBôKò.C÷(ð (r   r   )	Ú__doc__rC   Údjango.templater   Údjango.template.backends.djangor   Úbaser   Ú
BaseLoaderr5   r   r   Ú<module>rX      s&   ðñó
 å 0Ý :å &ôV(ˆZõ V(r   