File: //lib/python3/dist-packages/django/template/loaders/__pycache__/filesystem.cpython-310.pyc
o
ʎ�_� � @ sL d Z ddlmZ ddlmZmZ ddlmZ ddlm Z
G dd� de
�Z d S )
z4
Wrapper for loading templates from the filesystem.
� )�SuspiciousFileOperation)�Origin�TemplateDoesNotExist)� safe_join� )�Loaderc s6 e Zd Zd
� fdd� Zdd� Zdd� Zdd � Z� ZS )r Nc s t � �|� || _d S �N)�super�__init__�dirs)�self�enginer �� __class__� �D/usr/lib/python3/dist-packages/django/template/loaders/filesystem.pyr
s
zLoader.__init__c C s | j d ur| j S | jj S r )r r
)r r r r �get_dirs s zLoader.get_dirsc C sZ z!t |j| jjd��
}|�� W d � W S 1 sw Y W d S ty, t|��w )N)�encoding)�open�namer
�file_charset�read�FileNotFoundErrorr )r �origin�fpr r r �get_contents s (��zLoader.get_contentsc c sF � | � � D ]}zt||�}W n ty Y qw t||| d�V qdS )z�
Return an Origin object pointing to an absolute path in each directory
in template_dirs. For security reasons, if a path doesn't lie inside
one of the template_dirs it is excluded from the result set.
)r �
template_name�loaderN)r r r r )r r �template_dirr r r r �get_template_sources s ��
��zLoader.get_template_sourcesr )�__name__�
__module__�__qualname__r
r r r �
__classcell__r r r r r s
r N)�__doc__�django.core.exceptionsr �django.templater r �django.utils._osr �baser �
BaseLoaderr r r r �<module> s