
 Xa	                 @   s   d  d l  m Z d  d l m Z m Z d d l m Z d d l m Z d d l	 m
 Z
 d d d	  Z d d
 d  Z d d d d d  Z d d d  Z Gd d   d e j e e   Z d S)    )six)DeprecationInstanceCheckRemovedInDjango20Warning   )engines)Origin)TemplateDoesNotExistNc             C   s   g  } t  |  } xT | D]L } y | j |   SWq t k
 rd } z | j |  WYd d } ~ Xq Xq Wt |  d |  d S)zw
    Loads and returns a template for the given name.

    Raises TemplateDoesNotExist if no such template exists.
    Nchain)_engine_listget_templater   append)template_nameusingr	   r   enginee r   D/home/ubuntu/projects/ifolica/build/django/django/template/loader.pyr      s    $r   c             C   s   t  |  t j  r% t d |    n  g  } t |  } xe |  D]] } xT | D]L } y | j |  SWqK t k
 r } z | j |  WYd d } ~ XqK XqK Wq> W|  r t d j |   d |  n t d   d S)z
    Loads and returns a template for one of the given names.

    Tries names in order and returns the first template found.

    Raises TemplateDoesNotExist if no such template exists.
    zselect_template() takes an iterable of template names but got a string: %r. Use get_template() if you want to load a single template by name.Nz, r	   zNo template names provided)	
isinstancer   string_types	TypeErrorr
   r   r   r   join)Ztemplate_name_listr   r	   r   r   r   r   r   r   r   select_template   s    (r   c             C   sL   t  |  t t f  r* t |  d | } n t |  d | } | j | |  S)z
    Loads a template and renders it with a context. Returns a string.

    template_name may be a string or a list of strings.
    r   )r   listtupler   r   render)r   contextrequestr   templater   r   r   render_to_string:   s    r   c             C   s!   |  d  k r t  j   St  |  g S)N)r   all)r   r   r   r   r
   G   s    r
   c               @   s   e  Z d  Z d Z e Z d S)LoaderOriginzdjango.template.OriginN)__name__
__module____qualname__alternativer   Zdeprecation_warningr   r   r   r   r    K   s   r    )Zdjango.utilsr   Zdjango.utils.deprecationr   r    r   baser   
exceptionsr   r   r   r   r
   with_metaclassr    r   r   r   r   <module>   s   