
 X                 @   s   d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l m Z 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 m Z Gd
 d   d e  Z Gd d   d e j  Z d S)    )absolute_importN)settings)ImproperlyConfigured)OriginTemplateDoesNotExist)conditional_escape   )
BaseEngine)csrf_input_lazycsrf_token_lazyc                   s@   e  Z d  Z d Z   f d d   Z d d   Z d d   Z   S)TemplateStringsZtemplate_stringsc                sb   | j    } | j d  j    } | rH t d j d j |     n  t t |   j |  d  S)NOPTIONSzUnknown options: {}z, )copypopr   formatjoinsuperr   __init__)selfparamsoptions)	__class__ L/home/ubuntu/projects/ifolica/build/django/django/template/backends/dummy.pyr      s    zTemplateStrings.__init__c             C   s
   t  |  S)N)Template)r   template_coder   r   r   from_string   s    zTemplateStrings.from_stringc             C   s   g  } x |  j  |  D] } y1 t j | d t j  } | j   } Wd  QXWn_ t k
 r } z? | j t j k r | j	 t
 | | |   d f  w n    WYd  d  } ~ Xn Xt |  SWt | d | d |   d  S)NencodingzSource does not existtriedbackend)Ziter_template_filenamesioopenr   ZFILE_CHARSETreadIOErrorerrnoENOENTappendr   r   r   )r   Ztemplate_namer   Ztemplate_filefpr   er   r   r   get_template    s    
zTemplateStrings.get_template)__name__
__module____qualname__Zapp_dirnamer   r   r)   r   r   )r   r   r      s   r   c               @   s"   e  Z d  Z d d d d  Z d S)r   Nc             C   sj   | d  k r i  } n d d   | j    D } | d  k	 r] t |  | d <t |  | d <n  |  j |  S)Nc             S   s%   i  |  ] \ } } t  |  |  q Sr   )r   ).0kvr   r   r   
<dictcomp>;   s   	 z#Template.render.<locals>.<dictcomp>Z
csrf_inputZ
csrf_token)itemsr
   r   safe_substitute)r   contextrequestr   r   r   render7   s    	zTemplate.render)r*   r+   r,   r5   r   r   r   r   r   5   s   r   )
__future__r   r$   r    stringZdjango.confr   Zdjango.core.exceptionsr   Zdjango.templater   r   Zdjango.utils.htmlr   baser	   utilsr
   r   r   r   r   r   r   r   <module>   s   $