
    Evg]                         d dl Z d dlmZ d dlmZ d dlmZ ddlmZ ddl	m
Z
mZ ddlmZ dd	lmZ  G d
 d          ZdS )    N)ImproperlyConfigured)cached_propertyimport_string   Template)Context_builtin_context_processors)TemplateDoesNotExistimport_libraryc                       e Zd Zg dZ	 	 	 	 	 	 	 	 	 	 ddZd Zeej        d	                         Z	e
d
             Zd Zd Ze
d             Zd Zd ZddZd Zd ZddZd ZdS )Engine)zdjango.template.defaulttagszdjango.template.defaultfilterszdjango.template.loader_tagsNF utf-8Tc                 |   |g }|g }|dg}|r|dgz  }d|fg}n|rt          d          |i }|	g }	|| _        || _        |
| _        || _        || _        || _        || _        || _        || _	        | 
                    |          | _        | j        |	z   | _        |                     | j                  | _        d S )Nz)django.template.loaders.filesystem.Loaderz.django.template.loaders.app_directories.Loaderz%django.template.loaders.cached.Loaderz1app_dirs must not be set when loaders is defined.)r   dirsapp_dirs
autoescapecontext_processorsdebugloadersstring_if_invalidfile_charset	librariesget_template_librariestemplate_librariesdefault_builtinsbuiltinsget_template_builtinstemplate_builtins)selfr   r   r   r   r   r   r   r   r    r   s              S/var/www/pixelcanvas.ch/venv/lib/python3.11/site-packages/django/template/engine.py__init__zEngine.__init__   s    <D%!#?BCG NLMM?IJGG *G   IH	 $"4
!2(""&"="=i"H"H-8!%!;!;DM!J!J    c                    d| j         j        d| j        sdndt          | j                  z  d| j        | j        sdndt          | j                  z  d| j        dt          | j                  d	t          | j                  d
t          | j	                  | j
        sdndt          | j
                  z  | j        sdndt          | j                  z  dt          | j                  dS )N<:r   z dirs=%sz
 app_dirs=z context_processors=%sz debug=z	 loaders=z string_if_invalid=z file_charset=z libraries=%sz builtins=%sz autoescape=>)	__class____qualname__r   reprr   r   r   r   r   r   r   r    r   r#   s    r$   __repr__zEngine.__repr__A   s    
 N'''iABBZ$ty//%AAAMM .N-T5L0M0MMN N JJJ'(((("###nPBB/D<P<P*PPmMBB$t}:M:M)MMM!!!!%
 	
r&   c                      ddl m}  ddlm} |                                 D ]}t          ||          r	|j        c S t          d          )a  
        Return the first DjangoTemplates backend that's configured, or raise
        ImproperlyConfigured if none are configured.

        This is required for preserving historical APIs that rely on a
        globally available, implicitly configured engine such as:

        >>> from django.template import Context, Template
        >>> template = Template("Hello {{ name }}!")
        >>> context = Context({'name': "world"})
        >>> template.render(context)
        'Hello world!'
        r   )engines)DjangoTemplatesz)No DjangoTemplates backend is configured.)django.templater1   django.template.backends.djangor2   all
isinstanceenginer   )r1   r2   r7   s      r$   get_defaultzEngine.get_defaultW   ss    & 	,+++++CCCCCCkkmm 	% 	%F&/22 %}$$$%"#NOOOr&   c                 p    t           }|t          | j                  z  }t          d |D                       S )Nc              3   4   K   | ]}t          |          V  d S Nr   ).0paths     r$   	<genexpr>z5Engine.template_context_processors.<locals>.<genexpr>v   s*      HHT]4((HHHHHHr&   )r   tupler   )r#   r   s     r$   template_context_processorsz"Engine.template_context_processorsr   s<    8eD$;<<<HH5GHHHHHHr&   c                     d |D             S )Nc                 ,    g | ]}t          |          S  r   )r<   xs     r$   
<listcomp>z0Engine.get_template_builtins.<locals>.<listcomp>y   s     444aq!!444r&   rC   )r#   r    s     r$   r!   zEngine.get_template_builtinsx   s    4484444r&   c                 b    i }|                                 D ]\  }}t          |          ||<   |S r;   )itemsr   )r#   r   loadednamer=   s        r$   r   zEngine.get_template_libraries{   s<    #//++ 	0 	0JD$)$//F4LLr&   c                 6    |                      | j                  S r;   )get_template_loadersr   r.   s    r$   template_loaderszEngine.template_loaders   s    ((666r&   c                 l    g }|D ].}|                      |          }||                    |           /|S r;   )find_template_loaderappend)r#   rL   r   template_loaderloaders        r$   rK   zEngine.get_template_loaders   sG    / 	' 	'O..??F!v&&&r&   c                     t          |t          t          f          r|^}}ng }t          |t                    rt	          |          } || g|R  S t          d|z            )Nz3Invalid value in template loaders configuration: %r)r6   r?   liststrr   r   )r#   rQ   argsloader_classs       r$   rN   zEngine.find_template_loader   sy    fudm,, 	"MFTTDfc"" 	(00L<,t,,,,&EN  r&   c                     g }| j         D ]U}	 |                    ||          }||j        fc S # t          $ r$}|                    |j                   Y d }~Nd }~ww xY wt          ||          )N)skip)tried)rL   get_templateoriginr   extendrY   )r#   rI   r   rX   rY   rQ   templatees           r$   find_templatezEngine.find_template   s    + 	& 	&F&!..t$.??0000' & & &QW%%%%%%%%&"4u5555s   /
AAAc                 $    t          ||           S )z
        Return a compiled Template object for the given template code,
        handling template inheritance recursively.
        r7   r   )r#   template_codes     r$   from_stringzEngine.from_string   s    
 d3333r&   c                 |    |                      |          \  }}t          |d          st          ||||           }|S )z
        Return a compiled Template object for the given template name,
        handling template inheritance recursively.
        renderra   )r_   hasattrr	   )r#   template_namer]   r[   s       r$   rZ   zEngine.get_template   sJ    
  --m<<&x** 	N&-MMMHr&   c                 6   t          |t          t          f          r|                     |          }n|                     |          }t          |t
                    r|                    |          S |                    t          || j                            S )z
        Render the template specified by template_name with the given context.
        For use in Django's test suite.
        )r   )r6   rS   r?   select_templaterZ   r
   re   r   )r#   rg   contextts       r$   render_to_stringzEngine.render_to_string   s    
 mdE]33 	1$$]33AA!!-00A gw'' 	J88G$$$88GGHHHIIIr&   c                 0   |st          d          g }|D ]_}	 |                     |          c S # t           $ r9}|j        d         |vr |                    |j        d                    Y d}~Xd}~ww xY wt          d                    |                    )zV
        Given a list of template names, return the first that can be loaded.
        zNo template names providedr   Nz, )r   rZ   rU   rO   join)r#   template_name_list	not_foundrg   excs        r$   ri   zEngine.select_template   s     " 	E&'CDDD	/ 	 	M((77777'   8A;i//$$SXa[111
 #499Y#7#7888s   0
A3/A..A3)
NFNFNr   r   NNT)NNr;   )__name__
__module__r,   r   r%   r/   staticmethod	functools	lru_cacher8   r   r@   r!   r   rL   rK   rN   r_   rc   rZ   rl   ri   rC   r&   r$   r   r      sh          +K +K +K +KZ
 
 
, P P  \P2 I I _I
5 5 5   7 7 _7    6 6 6 64 4 4	 	 	J J J J 9 9 9 9 9r&   r   )ru   django.core.exceptionsr   django.utils.functionalr   django.utils.module_loadingr   baser	   rj   r
   r   
exceptionsr   libraryr   r   rC   r&   r$   <module>r}      s        7 7 7 7 7 7 3 3 3 3 3 3 5 5 5 5 5 5       9 9 9 9 9 9 9 9 , , , , , , # # # # # #I9 I9 I9 I9 I9 I9 I9 I9 I9 I9r&   