B :`@sddlZejrddlmZGdddeZGdddeeeZ Gdd d e Z Gd d d eZ Gd d d e Z GdddeZ Gddde ZGddde ZGddde ZdS)N) UndefinedcsHeZdZdZd ejeddfdd ZeejedddZ Z S) TemplateErrorz"Baseclass for all template errors.N)messagereturncst|dS)N)super__init__)selfr) __class__B/opt/alt/python37/lib/python3.7/site-packages/jinja2/exceptions.pyr szTemplateError.__init__)rcCs|jr|jdSdS)Nr)args)r r r r r szTemplateError.message)N) __name__ __module__ __qualname____doc__tOptionalstrrpropertyr __classcell__r r )r r rsrc@s\eZdZUdZdZejeed<d ejej edfejeddddZ edd 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. Nrr)namerrcCsNt|||dkr6ddlm}t||r2||}||_||_|g|_dS)Nr)r) IOErrorrruntimer isinstanceZ_fail_with_undefined_errorrr templates)r rrrr r r rs   zTemplateNotFound.__init__)rcCs t|jS)N)rr)r r r r __str__1szTemplateNotFound.__str__)N) rrrrrrrr__annotations__Unionrrr r r r rs rcsBeZdZdZdejejedfejeddfdd 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 r Nr)namesrrcs|dkrbddlm}g}x.|D]&}t||r:||jq||qWdtt|}d|}t |rt|dnd|t ||_ dS)Nr)rz, z(none of the templates given were found: ) rrrappendZ_undefined_messagejoinmaprrrlistr)r r!rrpartsrZ parts_str)r r r rAs    zTemplatesNotFound.__init__)r N) rrrrrSequencerrrrrr r )r r r 5s r csReZdZdZd eeejeejeddfdd ZedddZ d d Z Z S) TemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.N)rlinenorfilenamercs.t|||_||_||_d|_d|_dS)NF)rrr*rr+source translated)r rr*rr+)r r r r[s  zTemplateSyntaxError.__init__)rcCs|jrtt|jSd|j}|jp*|j}|r@d|d|}tt|jd|g}|jdk ry|j |jd}Wnt k rYnX| d| d |S)Nzline zFile "z", z rz  )r-rcastrrr*r+rr, splitlines IndexErrorr#stripr$)r locationrlinesliner r r rls   zTemplateSyntaxError.__str__cCs|j|j|j|j|jffS)N)r rr*rr+)r r r r __reduce__szTemplateSyntaxError.__reduce__)NN) rrrrrintrrrrr6rr r )r r r)Xs  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 r8sr8c@seZdZdZdS)TemplateRuntimeErrorzoA generic runtime error in the template engine. Under some situations Jinja may raise this exception. N)rrrrr r r r r9sr9c@seZdZdZdS)UndefinedErrorzs  ##3