3
(h                 @   sH   d Z ddlZddlmZmZ ddlmZ ddlmZ	 G dd de	ZdS )	z9
Wrapper for loading templates from a plain Python dict.
    N)OriginTemplateDoesNotExist)RemovedInDjango20Warning   )Loaderc                   s6   e Zd Z fddZdd Zdd Zd
dd	Z  ZS )r   c                s   || _ tt| j| d S )N)templates_dictsuperr   __init__)selfZenginer   )	__class__ B/tmp/pip-install-q3hcpn_q/Django/django/template/loaders/locmem.pyr	      s    zLoader.__init__c             C   s.   y| j |j S  tk
r(   t|Y nX d S )N)r   nameKeyErrorr   )r
   originr   r   r   get_contents   s    zLoader.get_contentsc             c   s   t ||| dV  d S )N)r   template_nameloader)r   )r
   r   r   r   r   get_template_sources   s    zLoader.get_template_sourcesNc             C   s<   t jdt y| j| |fS  tk
r6   t|Y nX d S )Nz_The load_template_sources() method is deprecated. Use get_template() or get_contents() instead.)warningswarnr   r   r   r   )r
   r   Ztemplate_dirsr   r   r   load_template_source    s    zLoader.load_template_source)N)__name__
__module____qualname__r	   r   r   r   __classcell__r   r   )r   r   r      s   r   )
__doc__r   Zdjango.templater   r   Zdjango.utils.deprecationr   baser   Z
BaseLoaderr   r   r   r   <module>   s
   