3
(h                 @   sH   d dl Z d dlmZmZmZ d dlmZ d dlmZ G dd de	Z
dS )    N)OriginTemplateTemplateDoesNotExist)RemovedInDjango20Warning)func_supports_parameterc               @   sX   e Zd Zdd ZdddZdddZddd	Zd
d ZdddZdd Z	e
dd ZdS )Loaderc             C   s
   || _ d S )N)engine)selfr    r
   @/tmp/pip-install-q3hcpn_q/Django/django/template/loaders/base.py__init__
   s    zLoader.__init__Nc             C   s   | j ||S )N)load_template)r	   template_nametemplate_dirsr
   r
   r   __call__   s    zLoader.__call__c             C   s   g }|g}t | jdr |j| xx| j| D ]j}|dk	rP||krP|j|df q,y| j|}W n$ tk
r   |j|df w,Y q,X t|||j| jS q,W t||ddS )a  
        Calls self.get_template_sources() and returns a Template object for
        the first template matching template_name. If skip is provided,
        template origins in skip are ignored. This is used to avoid recursion
        during template extending.
        r   NZSkippedzSource does not exist)tried)r   get_template_sourcesappendget_contentsr   r   r   r   )r	   r   r   skipr   argsorigincontentsr
   r
   r   get_template   s     
zLoader.get_templatec             C   sd   t jdt | j||\}}t||| d}yt|||| j}W n tk
rV   ||fS X |d fS d S )NzEThe load_template() method is deprecated. Use get_template() instead.)namer   loader)warningswarnr   load_template_sourcer   r   r   r   )r	   r   r   sourceZdisplay_namer   templater
   r
   r   r   1   s    
zLoader.load_templatec             C   s   t ddS )zg
        An iterator that yields possible matching template paths for a
        template name.
        zAsubclasses of Loader must provide a get_template_sources() methodN)NotImplementedError)r	   r   r
   r
   r   r   I   s    zLoader.get_template_sourcesc             C   s   t ddS )z
        RemovedInDjango20Warning: Returns a tuple containing the source and
        origin for the given template name.
        zAsubclasses of Loader must provide a load_template_source() methodN)r!   )r	   r   r   r
   r
   r   r   R   s    zLoader.load_template_sourcec             C   s   dS )z~
        Resets any state maintained by the loader instance (e.g. cached
        templates or cached loader modules).
        Nr
   )r	   r
   r
   r   reset[   s    zLoader.resetc             C   s
   t | dS )z
        RemovedInDjango20Warning: This is an internal property used by the
        ExtendsNode during the deprecation of non-recursive loaders.
        r   )hasattr)r	   r
   r
   r   supports_recursionb   s    zLoader.supports_recursion)N)NN)N)N)__name__
__module____qualname__r   r   r   r   r   r   r"   propertyr$   r
   r
   r
   r   r      s   

 
	
	r   )r   Zdjango.templater   r   r   Zdjango.utils.deprecationr   Zdjango.utils.inspectr   objectr   r
   r
   r
   r   <module>   s   