o :`@sddlZejr ddlmZGdddeZGdddeeeZ Gdd d e Z Gd d d eZ Gd d d e Z GdddeZ Gddde ZGddde ZGddde ZdS)N UndefinedcsJeZdZdZd dejeddffdd ZedejefddZ Z S) TemplateErrorz"Baseclass for all template errors.Nmessagereturncst|dSN)super__init__)selfr __class__3/usr/lib/python3/dist-packages/jinja2/exceptions.pyr szTemplateError.__init__cCs|jr|jdSdS)Nr)argsr rrrr szTemplateError.messager) __name__ __module__ __qualname____doc__tOptionalstrr propertyr __classcell__rrr rrs rc@sbeZdZUdZdZejeed< d dejej edfdejeddfddZ defd d Z dS) 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. NrnamerrcCsNt|||durddlm}t||r||}||_||_|g|_dS)Nrr) IOErrorr runtimer isinstance_fail_with_undefined_errorrr templates)r rrrrrrr s    zTemplateNotFound.__init__cCs t|jSr)rrrrrr__str__1s zTemplateNotFound.__str__r) rrrrrrrr__annotations__Unionr r"rrrrrs   rcsJeZdZdZ  d dejejedfdejeddffdd Z Z S) 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 rNnamesrrrcs|dur/ddlm}g}|D]}t||r||jq||qdtt|}d|}t |r8|dnd|t ||_ dS)Nrrz, z(none of the templates given were found: ) rrrappend_undefined_messagejoinmaprr r listr!)r r&rrpartsr parts_strr rrr As    zTemplatesNotFound.__init__)rN) rrrrrSequencer$rrr rrrr rr%5s r%c s^eZdZdZ  ddededejedejeddf fdd Zdefd d Z d d Z Z S)TemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.Nrlinenorfilenamercs.t|||_||_||_d|_d|_dS)NF)r r r1rr2source translated)r rr1rr2r rrr [s  zTemplateSyntaxError.__init__cCs|jr tt|jSd|j}|jp|j}|r d|d|}tt|jd|g}|jdurOz |j |jd}Wn t yEYn w| d| d |S)Nzline zFile "z", z rz  )r4rcastrrr1r2rr3 splitlines IndexErrorr(stripr*)r locationrlineslinerrrr"ls     zTemplateSyntaxError.__str__cCs|j|j|j|j|jffSr)r rr1rr2rrrr __reduce__szTemplateSyntaxError.__reduce__)NN) rrrrrintrrr r"r=rrrr rr0Xs"r0c@eZdZdZdS)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@r@c@r?)TemplateRuntimeErrorzoA generic runtime error in the template engine. Under some situations Jinja may raise this exception. NrArrrrrCrBrCc@r?)UndefinedErrorzs  ##3