B
    ©‰AdÏ  ã               @   s²   d dl ZejrddlmZ G dd„ deƒZG dd„ dee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G dd„ deƒZG dd„ deƒZdS )é    Né   )Ú	Undefinedc                   sH   e Zd ZdZd	eje ddœ‡ fdd„Zeeje dœdd„ƒZ	‡  Z
S )
ÚTemplateErrorz"Baseclass for all template errors.N)ÚmessageÚreturnc                s   t ƒ  |¡ d S )N)ÚsuperÚ__init__)Úselfr   )Ú	__class__© úC/var/www/html/venv/lib/python3.7/site-packages/jinja2/exceptions.pyr   
   s    zTemplateError.__init__)r   c             C   s   | j r| j d S d S )Nr   )Úargs)r	   r   r   r   r      s    zTemplateError.message)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚtÚOptionalÚstrr   Úpropertyr   Ú__classcell__r   r   )r
   r   r      s   r   c               @   s\   e Zd ZU dZdZeje ed< dejej	edf  eje ddœdd„Z
edœd	d
„ZdS )ÚTemplateNotFoundzÀRaised if a template does not exist.

    .. versionchanged:: 2.11
        If the given name is :class:`Undefined` and no message was
        provided, an :exc:`UndefinedError` is raised.
    Nr   r   )Únamer   r   c             C   sN   t  | |¡ |d kr6ddlm} t||ƒr2| ¡  |}|| _|| _|g| _d S )Nr   )r   )	ÚIOErrorr   Úruntimer   Ú
isinstanceZ_fail_with_undefined_errorr   r   Ú	templates)r	   r   r   r   r   r   r   r      s    
zTemplateNotFound.__init__)r   c             C   s
   t | jƒS )N)r   r   )r	   r   r   r   Ú__str__1   s    zTemplateNotFound.__str__)N)r   r   r   r   r   r   r   r   Ú__annotations__ÚUnionr   r   r   r   r   r   r      s
   
r   c                   sB   e Zd ZdZdejejedf  eje ddœ‡ fdd„Z	‡  Z
S )	ÚTemplatesNotFounda”  Like :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.

    .. versionchanged:: 2.11
        If a name in the list of names is :class:`Undefined`, a message
        about it being undefined is shown rather than the empty string.

    .. versionadded:: 2.2
    r   Nr   )Únamesr   r   c                sŠ   |d krbddl m} g }x.|D ]&}t||ƒr:| |j¡ q| |¡ qW d tt|ƒ¡}d|› }tƒ  	|rt|d nd |¡ t
|ƒ| _d S )Nr   )r   z, z(none of the templates given were found: éÿÿÿÿ)r   r   r   ÚappendZ_undefined_messageÚjoinÚmapr   r   r   Úlistr   )r	   r!   r   r   Úpartsr   Z	parts_str)r
   r   r   r   A   s    


zTemplatesNotFound.__init__)r   N)r   r   r   r   r   ÚSequencer   r   r   r   r   r   r   )r
   r   r    5   s   
 r    c                   sR   e Zd ZdZdeeeje eje ddœ‡ fdd„Zedœdd„Z	d	d
„ Z
‡  ZS )ÚTemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.N)r   Úlinenor   Úfilenamer   c                s.   t ƒ  |¡ || _|| _|| _d | _d| _d S )NF)r   r   r*   r   r+   ÚsourceÚ
translated)r	   r   r*   r   r+   )r
   r   r   r   [   s    zTemplateSyntaxError.__init__)r   c             C   sª   | j rt t| j¡S d| j› }| jp*| j}|r@d|› d|› }t t| j¡d| g}| jd k	r y| j 	¡ | jd  }W n t
k
rŒ   Y nX | d| ¡  ¡ d |¡S )Nzline zFile "z", z  r   z    Ú
)r-   r   Úcastr   r   r*   r+   r   r,   Ú
splitlinesÚ
IndexErrorr#   Ústripr$   )r	   Úlocationr   ÚlinesÚliner   r   r   r   l   s    
zTemplateSyntaxError.__str__c             C   s   | j | j| j| j| jffS )N)r
   r   r*   r   r+   )r	   r   r   r   Ú
__reduce__ƒ   s    zTemplateSyntaxError.__reduce__)NN)r   r   r   r   r   Úintr   r   r   r   r6   r   r   r   )r
   r   r)   X   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   r8   ‹   s   r8   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   r9   “   s   r9   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   r:   ™   s   r:   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   r;      s   r;   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   r<   £   s   r<   )Útypingr   ÚTYPE_CHECKINGr   r   Ú	Exceptionr   r   ÚLookupErrorr   r    r)   r8   r9   r:   r;   r<   r   r   r   r   Ú<module>   s   ##3