
    hK                         S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
JrJr  S SKJr  S SKJr  S S	KJr  S S
KJr  SSKJr   " S S\5      r " S S5      rSS jrS rS rS rS rg)    )defaultdict)import_module)walk_packages)apps)settings)ErrorWarning)TemplateDoesNotExist)make_context)Engine)InvalidTemplateLibrary   )
BaseEnginec                   P   ^  \ rS rSrSrU 4S jrS rS rS rS r	S r
S	 rS
rU =r$ )DjangoTemplates   	templatesc                   > UR                  5       nUR                  S5      R                  5       nUR                  SS5        UR                  S[        R                  5        UR                  SS5        UR                  S0 5      nU R                  U5      US'   [        TU ]!  U5        [        U R                  U R                  40 UD6U l        g )NOPTIONS
autoescapeTdebugfile_charsetzutf-8	libraries)copypop
setdefaultr   DEBUGgetget_templatetag_librariessuper__init__r   dirsapp_dirsengine)selfparamsoptionsr   	__class__s       Q/var/www/html/env/lib/python3.13/site-packages/django/template/backends/django.pyr!   DjangoTemplates.__init__   s    **Y',,.<.7HNN3>73KKR0	#==iH TYYAA    c                 F    / U R                  5       QU R                  5       Q$ N)"_check_string_if_invalid_is_string+_check_for_template_tags_with_the_same_name)r%   kwargss     r)   checkDjangoTemplates.check   s.    
446
==?
 	
r+   c                     U R                   R                  n[        U[        5      (       d  [	        SU< S[        U5      < S3U SS9/$ / $ )NzC'string_if_invalid' in TEMPLATES OPTIONS must be a string but got: z (z).ztemplates.E002objid)r$   string_if_invalid
isinstancestrr   type)r%   values     r)   r.   2DjangoTemplates._check_string_if_invalid_is_string$   sK    --%%%',d5k;'	  	r+   c           	         [        [        5      n[        5        H  u  p#X   R                  U5        M     U R                  R
                  R                  5        H  u  p#X   R                  U5        M     / nUR                  5        HW  u  pV[        U5      S:  d  M  SR                  S [        U5       5       5      nUR                  [        U< SU 3U SS95        MY     U$ )Nr   z, c              3   8   #    U  H  n[        U5      v   M     g 7fr-   )repr).0items     r)   	<genexpr>NDjangoTemplates._check_for_template_tags_with_the_same_name.<locals>.<genexpr>>   s     !G$t**s   z, is used for multiple template tag modules: ztemplates.W003r4   )r   setget_template_tag_modulesaddr$   r   itemslenjoinsortedappendr	   )r%   r   module_namemodule_patherrorslibrary_namerG   s          r)   r/   ;DjangoTemplates._check_for_template_tags_with_the_same_name1   s    $	(@(B$K"&&{3 )C )-(=(=(C(C(E$K"&&{3 )F #,??#4L5zA~		!G!GG'**V '# +	 $5 r+   c                 L    [        U R                  R                  U5      U 5      $ r-   )Templater$   from_string)r%   template_codes     r)   rS   DjangoTemplates.from_stringJ   s    //>EEr+   c                      [        U R                  R                  U5      U 5      $ ! [         a  n[	        X 5         S nAg S nAff = fr-   )rR   r$   get_templater
   reraise)r%   template_nameexcs      r)   rW   DjangoTemplates.get_templateM   s>    	DKK44]CTJJ# 	C	s   $' 
AAAc                 <    [        5       nUR                  U5        U$ )zv
Return a collation of template tag libraries from installed
applications and the supplied custom_libraries argument.
)get_installed_librariesupdate)r%   custom_librariesr   s      r)   r   )DjangoTemplates.get_templatetag_librariesS   s!    
 ,-	)*r+   )r$   )__name__
__module____qualname____firstlineno__app_dirnamer!   r1   r.   r/   rS   rW   r   __static_attributes____classcell__)r(   s   @r)   r   r      s2    K	B
2F r+   r   c                   4    \ rS rSrS r\S 5       rSS jrSrg)rR   ]   c                     Xl         X l        g r-   )templatebackend)r%   rk   rl   s      r)   r!   Template.__init__^   s     r+   c                 .    U R                   R                  $ r-   )rk   origin)r%   s    r)   ro   Template.originb   s    }}###r+   Nc                     [        XU R                  R                  R                  S9n U R                  R                  U5      $ ! [         a  n[        X0R                  5         S nAg S nAff = f)N)r   )r   rl   r$   r   rk   renderr
   rX   )r%   contextrequestrZ   s       r)   rr   Template.renderf   sZ    )<)<)G)G
	'==''00# 	'C&&	's   A 
A.A))A.)rl   rk   )NN)	ra   rb   rc   rd   r!   propertyro   rr   rf    r+   r)   rR   rR   ]   s      $ $'r+   rR   Nc                     U=(       d    U R                   nU R                  " U R                  U R                  XR                  S.6n[        U S5      (       a  U R                  Ul        U$ )z
Create a new TemplateDoesNotExist. Preserve its declared attributes and
template debug data but discard __traceback__, __context__, and __cause__
to make this object suitable for keeping around (in a cache, for example).
)triedrl   chaintemplate_debug)rl   r(   argsry   rz   hasattrr{   rZ   rl   news      r)   copy_exceptionr   p   sQ     $G
--G99
UCs$%% //Jr+   c                     [        X5      nX e)zL
Reraise TemplateDoesNotExist while maintaining template debug information.
)r   r~   s      r)   rX   rX   }   s     
&C
r+   c               #   F  #    S/n U R                  S [        R                  " 5        5       5        U  HX  n [        U5      n[        US5      (       d  M"  [        U5       H'  nUR                  U5      R                  S5      U4v   M)     MZ     g! [         a     Mj  f = f7f)zR
Yield (module_name, module_path) pairs for all installed template tag
libraries.
zdjango.templatetagsc              3   >   #    U  H  oR                    S 3v   M     g7f)z.templatetagsN)name)r@   
app_configs     r)   rB   +get_template_tag_modules.<locals>.<genexpr>   s      <Rj??
=)<Rs   __path__.N)	extendr   get_app_configsr   ImportErrorr}   get_package_librariesremoveprefixlstrip)
candidates	candidatepkgr   s       r)   rE   rE      s     
 ((J <@<P<P<R   			*C
 3
##-c2''	299#>DD 3    		s.   4B!BB!;B!
BB!BB!c                  L    [        5        V Vs0 s H  u  pX_M	     snn $ s  snn f )z
Return the built-in template tag libraries and those from installed
applications. Libraries are stored in a dictionary where keys are the
individual module names, not the full module paths. Example:
django.templatetags.i18n is stored as i18n.
)rE   )rL   	full_names     r)   r]   r]      s0     >V=W=W#9;=W  s    c              #     #    [        U R                  U R                  S-   5       H,  n [        US   5      n[        US5      (       d  M%  US   v   M.     g! [         a  n[        SUS   < SU< 35      UeSnAff = f7f)zN
Recursively yield template tag libraries defined in submodules of a
package.
r   r   zLInvalid template library specified. ImportError raised when trying to load 'z': Nregister)r   r   ra   r   r   r   r}   )r   entrymodulees       r)   r   r      s     
 s||S\\C-?@	"58,F 6:&&(N A  	(-21Xq: 	s-   'B AB B 
A=!A88A==B r-   )collectionsr   	importlibr   pkgutilr   django.appsr   django.confr   django.core.checksr   r	   django.templater
   django.template.contextr   django.template.enginer   django.template.libraryr   baser   r   rR   r   rX   rE   r]   r   rw   r+   r)   <module>r      sY    # # !    - 0 0 ) : Jj JZ' '&
E,	r+   