o
    {,h
                     @   sF   d dl mZmZ d dlmZ d dlmZ d dlmZ G dd dZ	dS )    )ImproperlyConfiguredSuspiciousFileOperation)get_app_template_dirs)	safe_join)cached_propertyc                   @   sL   e Zd Zdd Zdd Zedd Zdd Zd	d
 Ze	dd Z
dd ZdS )
BaseEnginec                 C   sL   |  }|d| _t|d| _|d| _|r$tdd|dS )zh
        Initialize the template engine.

        `params` is a dict of configuration settings.
        NAMEDIRSAPP_DIRSzUnknown parameters: {}z, N)	copypopnamelistdirsapp_dirsr   formatjoin)selfparams r   S/var/www/html/rh/venv/lib/python3.10/site-packages/django/template/backends/base.py__init__   s   zBaseEngine.__init__c                 K   s   g S )Nr   )r   kwargsr   r   r   check   s   zBaseEngine.checkc                 C   s   t d| jj)NzA{} doesn't support loading templates from installed applications.)r   r   	__class____name__)r   r   r   r   app_dirname   s   
zBaseEngine.app_dirnamec                 C      t d)zk
        Create and return a template for the given source code.

        This method is optional.
        z>subclasses of BaseEngine should provide a from_string() methodNotImplementedError)r   template_coder   r   r   from_string$      zBaseEngine.from_stringc                 C   r   )z
        Load and return a template for the given name.

        Raise TemplateDoesNotExist if no such template exists.
        z=subclasses of BaseEngine must provide a get_template() methodr   )r   template_namer   r   r   get_template.   r"   zBaseEngine.get_templatec                 C   s"   t | j}| jr|t| j7 }|S )zG
        Return a list of directories to search for templates.
        )tupler   r   r   r   )r   template_dirsr   r   r   r&   ;   s   
zBaseEngine.template_dirsc              	   c   s4    | j D ]}zt||V  W q ty   Y qw dS )z
        Iterate over candidate files for template_name.

        Ignore files that don't lie inside configured template dirs to avoid
        directory traversal attacks.
        N)r&   r   r   )r   r#   template_dirr   r   r   iter_template_filenamesF   s   
z"BaseEngine.iter_template_filenamesN)r   
__module____qualname__r   r   propertyr   r!   r$   r   r&   r(   r   r   r   r   r      s    



r   N)
django.core.exceptionsr   r   django.template.utilsr   django.utils._osr   django.utils.functionalr   r   r   r   r   r   <module>   s
    