a `1@sddlmZddlmZddlmZddlmZGdddeZeGdddeeeZ Gd d d e Z eGd d d eZ Gd dde Z GdddeZ Gddde ZGddde ZGddde ZdS))imap)implements_to_string)PY2) text_typec@sJeZdZdZer0d ddZeddZddZnd d dZed dZdS) TemplateErrorz"Baseclass for all template errors.NcCs&|durt|d}t||dS)Nutf-8)rencode Exception__init__selfmessager5/usr/lib/python3.9/site-packages/jinja2/exceptions.pyr szTemplateError.__init__cCs(|jr$|jd}|dur$|ddSdS)Nrreplace)argsdecoder rrrr s zTemplateError.messagecCs |jpdS)Nr r rrr __unicode__szTemplateError.__unicode__cCst||dSN)r r r rrrr scCs |jr|jd}|dur|SdS)Nr)rr rrrr !s )N)N) __name__ __module__ __qualname____doc__rr propertyr rrrrrrs    rc@s&eZdZdZdZdddZddZdS)TemplateNotFoundzRaised 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. NcCsNt|||dur6ddlm}t||r2||}||_||_|g|_dS)Nr Undefined) IOErrorr runtimer isinstanceZ_fail_with_undefined_errorr name templates)r r$r r rrrr 6s   zTemplateNotFound.__init__cCs|jSrrrrrr__str__EszTemplateNotFound.__str__)N)rrrrr r r&rrrrr)s  rc@seZdZdZdddZdS)TemplatesNotFoundaLike :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 rNcCs|durXddlm}g}|D]&}t||r8||jq||qddtt|}t ||rj|dpld|t ||_ dS)Nrrz(none of the templates given were found: z, ) r"r r#appendZ_undefined_messagejoinrrrr listr%)r namesr r partsr$rrrr Us   zTemplatesNotFound.__init__)rN)rrrrr rrrrr'Is r'c@s*eZdZdZd ddZddZddZdS) TemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.NcCs.t||||_||_||_d|_d|_dS)NF)rr linenor$filenamesource translated)r r r/r$r0rrrr ls  zTemplateSyntaxError.__init__cCs|jr |jSd|j}|jp |j}|r2d||f}|jd|g}|jdurz|j|jd}Wntyxd}Yn0|r|d| d |S)Nzline %dz File "%s", %sz rz  ) r2r r/r0r$r1 splitlines IndexErrorr)stripr*)r locationr$lineslinerrrr&ws      zTemplateSyntaxError.__str__cCs|j|j|j|j|jffSr) __class__r r/r$r0rrrr __reduce__szTemplateSyntaxError.__reduce__)NN)rrrrr r&r;rrrrr.hs 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. Nrrrrrrrrr<sr<c@seZdZdZdS)TemplateRuntimeErrorzoA generic runtime error in the template engine. Under some situations Jinja may raise this exception. Nr=rrrrr>sr>c@seZdZdZdS)UndefinedErrorzr?r@rArrrrs    !-