異常

2018-02-24 15:39 更新

exception?jinja2.TemplateError(message=None)

Baseclass for all template errors.

exception?jinja2.UndefinedError(message=None)

Raised if a template tries to operate on?Undefined.

exception?jinja2.TemplateNotFound(name,?message=None)

Raised if a template does not exist.

exception?jinja2.TemplatesNotFound(names=(),?message=None)

Like?TemplateNotFound?but raised if multiple templates are selected. This is a subclass of?TemplateNotFound?exception, so just catching the base exception will catch both.

New in version 2.2.

exception?jinja2.TemplateSyntaxError(message,?lineno,?name=None,filename=None)

Raised to tell the user that there is a problem with the template.

message

錯誤信息的 utf-8 字節(jié)串。

lineno

發(fā)生錯誤的行號。

name

模板的加載名的 unicode 字符串。

filename

加載的模板的文件名字節(jié)串,以文件系統(tǒng)的編碼(多是 utf-8 , Windows 是 mbcs )。

文件名和錯誤消息是字節(jié)串而不是 unicode 字符串的原因是,在 Python 2.x 中,不對異常和回溯使用 unicode ,編譯器同樣。這會在 Python 3 改變。

exception?jinja2.TemplateAssertionError(message,?lineno,?name=None,filename=None)

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?TemplateSyntaxError?and has the same attributes.

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號