HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/django/template/__pycache__/engine.cpython-310.pyc
o

�h5�@srddlZddlmZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
dd	lmZGd
d�d�ZdS)�N)�ImproperlyConfigured)�cached_property��
import_string���Template)�Context�_builtin_context_processors)�TemplateDoesNotExist��import_libraryc@s�eZdZgd�Z										d#dd�Zd	d
�Zeejdd���Z	e
d
d��Zdd�Zdd�Z
e
dd��Zdd�Zdd�Zd$dd�Zdd�Zdd�Zd%dd �Zd!d"�ZdS)&�Engine)zdjango.template.defaulttagszdjango.template.defaultfilterszdjango.template.loader_tagsNF��utf-8TcCs�|durg}|durg}|dur dg}|r|dg7}d|fg}n|r&td��|dur,i}|	dur2g}	||_||_|
|_||_||_||_||_||_||_	|�
|�|_|j|	|_
|�|j
�|_dS)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)�selfrrrrrrrrrr�r!�I/usr/local/CyberCP/lib/python3.10/site-packages/django/template/engine.py�__init__s:

�zEngine.__init__c
Cs�d|jj|js	dndt|j�|j|jsdndt|j�|jt|j�t|j�t|j	�|j
s/dndt|j
�|js:dndt|j�t|j�fS)Nz`<%s:%s app_dirs=%s%s debug=%s loaders=%s string_if_invalid=%s file_charset=%s%s%s autoescape=%s>rz dirs=%sz context_processors=%sz
 libraries=%sz builtins=%s)
�	__class__�__qualname__r�reprrrrrrrrrr�r r!r!r"�__repr__As ���zEngine.__repr__cCsBddlm}ddlm}|��D]}t||�r|jSqtd��)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.templater)�django.template.backends.djangor*�all�
isinstance�enginer)r)r*r/r!r!r"�get_defaultUs

�zEngine.get_defaultcCs$t}|t|j�7}tdd�|D��S)Ncss�|]}t|�VqdS�Nr)�.0�pathr!r!r"�	<genexpr>ts�z5Engine.template_context_processors.<locals>.<genexpr>)r
�tupler)r rr!r!r"�template_context_processorspsz"Engine.template_context_processorscCsdd�|D�S)NcSsg|]}t|��qSr!r)r2�xr!r!r"�
<listcomp>wsz0Engine.get_template_builtins.<locals>.<listcomp>r!)r rr!r!r"rvszEngine.get_template_builtinscCs&i}|��D]
\}}t|�||<q|Sr1)�itemsr
)r r�loaded�namer3r!r!r"ryszEngine.get_template_librariescCs|�|j�Sr1)�get_template_loadersrr'r!r!r"�template_loadersszEngine.template_loaderscCs.g}|D]}|�|�}|dur|�|�q|Sr1)�find_template_loader�append)r r=r�template_loader�loaderr!r!r"r<�s

�zEngine.get_template_loaderscCsJt|ttf�r|^}}ng}t|t�rt|�}||g|�R�Std|��)Nz3Invalid value in template loaders configuration: %r)r.r5�list�strrr)r rA�args�loader_classr!r!r"r>�s

�zEngine.find_template_loadercCsjg}|jD])}z|j||d�}||jfWSty.}z|�|j�WYd}~qd}~wwt||d��)N)�skip)�tried)r=�get_template�originr�extendrG)r r;rrFrGrA�template�er!r!r"�
find_template�s
��zEngine.find_templatecCst||d�S)z�
        Return a compiled Template object for the given template code,
        handling template inheritance recursively.
        �r/r)r �
template_coder!r!r"�from_string�szEngine.from_stringcCs,|�|�\}}t|d�st||||d�}|S)z�
        Return a compiled Template object for the given template name,
        handling template inheritance recursively.
        �renderrN)rM�hasattrr)r �
template_namerKrIr!r!r"rH�s
zEngine.get_templatecCsLt|ttf�r
|�|�}n|�|�}t|t�r|�|�S|�t||jd��S)z�
        Render the template specified by template_name with the given context.
        For use in Django's test suite.
        )r)r.rBr5�select_templaterHr	rQr)r rS�context�tr!r!r"�render_to_string�s


zEngine.render_to_stringcCsz|std��g}|D]+}z|�|�WSty5}z|jd|vr+|�|jd�WYd}~q
d}~wwtd�|���)zV
        Given a list of template names, return the first that can be loaded.
        zNo template names providedrNz, )rrHrDr?�join)r �template_name_list�	not_foundrS�excr!r!r"rT�s��zEngine.select_template)
NFNFNrrNNT)NNr1)�__name__�
__module__r%rr#r(�staticmethod�	functools�	lru_cacher0rr6rrr=r<r>rMrPrHrWrTr!r!r!r"r
s<
�-




r)r_�django.core.exceptionsr�django.utils.functionalr�django.utils.module_loadingr�baserrUr	r
�
exceptionsr�libraryr
rr!r!r!r"�<module>s