3 C\L@sdZddlmZmZmZmZGdddeZeGdddee eZ Gddde Z eGd d d eZ Gd d d e Z Gd ddeZGdddeZGdddeZGdddeZdS)z jinja2.exceptions ~~~~~~~~~~~~~~~~~ Jinja exceptions. :copyright: (c) 2017 by the Jinja Team. :license: BSD, see LICENSE for more details. )imap text_typePY2implements_to_stringc@sJeZdZdZer0d ddZeddZddZnd d dZed dZdS) TemplateErrorz"Baseclass for all template errors.NcCs&|dk rt|jd}tj||dS)Nzutf-8)rencode Exception__init__)selfmessager i/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-emcbgzcf/jinja2/jinja2/exceptions.pyr szTemplateError.__init__cCs(|jr$|jd}|dk r$|jddSdS)Nrzutf-8replace)argsdecode)r r r r r r s zTemplateError.messagecCs |jpdS)N)r )r r r r __unicode__szTemplateError.__unicode__cCstj||dS)N)rr )r r r r r r !scCs |jr|jd}|dk r|SdS)Nr)r)r r r r r r $s )N)N) __name__ __module__ __qualname____doc__rr propertyr rr r r r rs    rc@s&eZdZdZdZdddZddZdS)TemplateNotFoundz$Raised if a template does not exist.NcCs.tj||dkr|}||_||_|g|_dS)N)IOErrorr r name templates)r rr r r r r 4s  zTemplateNotFound.__init__cCs|jS)N)r )r r r r __str__<szTemplateNotFound.__str__)N)rrrrr r rr r r r r,s rc@seZdZdZfdfddZdS)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 NcCsD|dkrddjtt|}tj||r.|dp0d|t||_dS)Nz(none of the templates given were found: z, )joinrrrr listr)r namesr r r r r Hs zTemplatesNotFound.__init__)rrrrr r r r r r@src@s"eZdZdZdddZddZdS)TemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.NcCs.tj||||_||_||_d|_d|_dS)NF)rr linenorfilenamesource translated)r r r$rr%r r r r Ts  zTemplateSyntaxError.__init__c Cs|jr |jSd|j}|jp |j}|r2d||f}|jd|g}|jdk ry|jj|jd}Wntk rzd}YnX|r|jd|j dj |S)Nzline %dz File "%s", %sz rz  ) r'r r$r%rr& splitlines IndexErrorappendstripr )r locationrlinesliner r r r_s     zTemplateSyntaxError.__str__)NN)rrrrr rr r r r r#Ps r#c@seZdZdZdS)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)rrrrr r r r r0wsr0c@seZdZdZdS)TemplateRuntimeErrorzoA generic runtime error in the template engine. Under some situations Jinja may raise this exception. N)rrrrr r r r r1sr1c@seZdZdZdS)UndefinedErrorz s   &