3
\f[                   @   s   d Z ddlmZmZmZmZ G dd deZeG dd dee	eZ
G dd de
ZeG d	d
 d
eZG dd deZG dd deZG dd deZG dd deZG dd deZdS )z
    jinja2.exceptions
    ~~~~~~~~~~~~~~~~~

    Jinja exceptions.

    :copyright: (c) 2017 by the Jinja Team.
    :license: BSD, see LICENSE for more details.
    )imap	text_typePY2implements_to_stringc               @   sJ   e Zd ZdZer0dddZedd Zdd Zndd	dZed
d ZdS )TemplateErrorz"Baseclass for all template errors.Nc             C   s&   |d k	rt |jd}tj| | d S )Nzutf-8)r   encode	Exception__init__)selfmessage r   CC:\prj\env\wsgidav_build_3.6\lib\site-packages\jinja2\exceptions.pyr	      s    zTemplateError.__init__c             C   s(   | j r$| j d }|d k	r$|jddS d S )Nr   zutf-8replace)argsdecode)r
   r   r   r   r   r      s    
zTemplateError.messagec             C   s
   | j pdS )N )r   )r
   r   r   r   __unicode__   s    zTemplateError.__unicode__c             C   s   t j| | d S )N)r   r	   )r
   r   r   r   r   r	   !   s    c             C   s    | j r| j d }|d k	r|S d S )Nr   )r   )r
   r   r   r   r   r   $   s    
)N)N)	__name__
__module____qualname____doc__r   r	   propertyr   r   r   r   r   r   r      s   


r   c               @   s&   e Zd ZdZdZdddZdd ZdS )TemplateNotFoundz$Raised if a template does not exist.Nc             C   s.   t j|  |d kr|}|| _|| _|g| _d S )N)IOErrorr	   r   name	templates)r
   r   r   r   r   r   r	   4   s    
zTemplateNotFound.__init__c             C   s   | j S )N)r   )r
   r   r   r   __str__<   s    zTemplateNotFound.__str__)N)r   r   r   r   r   r	   r   r   r   r   r   r   ,   s   
r   c               @   s   e Zd ZdZf dfddZdS )TemplatesNotFoundzLike :class:`TemplateNotFound` but raised if multiple templates
    are selected.  This is a subclass of :class:`TemplateNotFound`
    exception, so just catching the base exception will catch both.

    .. versionadded:: 2.2
    Nc             C   sD   |d krddj tt| }tj| |r.|d p0d | t|| _d S )Nz(none of the templates given were found: z,    )joinr   r   r   r	   listr   )r
   namesr   r   r   r   r	   H   s
    zTemplatesNotFound.__init__)r   r   r   r   r	   r   r   r   r   r   @   s   r   c               @   s"   e Zd ZdZdddZdd ZdS )TemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.Nc             C   s.   t j| | || _|| _|| _d | _d| _d S )NF)r   r	   linenor   filenamesource
translated)r
   r   r$   r   r%   r   r   r   r	   T   s    zTemplateSyntaxError.__init__c             C   s   | j r| jS d| j }| jp | j}|r2d||f }| jd| g}| jd k	ry| jj | jd  }W n tk
rz   d }Y nX |r|jd|j	   dj
|S )Nzline %dzFile "%s", %sz  r   z    
)r'   r   r$   r%   r   r&   
splitlines
IndexErrorappendstripr    )r
   locationr   linesliner   r   r   r   _   s    


zTemplateSyntaxError.__str__)NN)r   r   r   r   r	   r   r   r   r   r   r#   P   s   
r#   c               @   s   e Zd ZdZdS )TemplateAssertionErrora  Like a template syntax error, but covers cases where something in the
    template caused an error at compile time that wasn't necessarily caused
    by a syntax error.  However it's a direct subclass of
    :exc:`TemplateSyntaxError` and has the same attributes.
    N)r   r   r   r   r   r   r   r   r0   w   s   r0   c               @   s   e Zd ZdZdS )TemplateRuntimeErrorzoA generic runtime error in the template engine.  Under some situations
    Jinja may raise this exception.
    N)r   r   r   r   r   r   r   r   r1      s   r1   c               @   s   e Zd ZdZdS )UndefinedErrorz<Raised if a template tries to operate on :class:`Undefined`.N)r   r   r   r   r   r   r   r   r2      s   r2   c               @   s   e Zd ZdZdS )SecurityErrorzWRaised if a template tries to do something insecure if the
    sandbox is enabled.
    N)r   r   r   r   r   r   r   r   r3      s   r3   c               @   s   e Zd ZdZdS )FilterArgumentErrorzQThis error is raised if a filter was called with inappropriate
    arguments
    N)r   r   r   r   r   r   r   r   r4      s   r4   N)r   jinja2._compatr   r   r   r   r   r   r   LookupErrorr   r   r#   r0   r1   r2   r3   r4   r   r   r   r   <module>
   s   &