本文整理匯總了Python中jinja2.exceptions.SecurityError方法的典型用法代碼示例。如果您正苦於以下問題:Python exceptions.SecurityError方法的具體用法?Python exceptions.SecurityError怎麽用?Python exceptions.SecurityError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類jinja2.exceptions
的用法示例。
在下文中一共展示了exceptions.SecurityError方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: unsafe_undefined
# 需要導入模塊: from jinja2 import exceptions [as 別名]
# 或者: from jinja2.exceptions import SecurityError [as 別名]
def unsafe_undefined(self, obj, attribute):
"""Return an undefined object for unsafe attributes."""
return self.undefined('access to attribute %r of %r '
'object is unsafe.' % (
attribute,
obj.__class__.__name__
), name=attribute, obj=obj, exc=SecurityError)
示例2: call
# 需要導入模塊: from jinja2 import exceptions [as 別名]
# 或者: from jinja2.exceptions import SecurityError [as 別名]
def call(__self, __context, __obj, *args, **kwargs):
"""Call an object from sandboxed code."""
fmt = inspect_format_method(__obj)
if fmt is not None:
return __self.format_string(fmt, args, kwargs, __obj)
# the double prefixes are to avoid double keyword argument
# errors when proxying the call.
if not __self.is_safe_callable(__obj):
raise SecurityError('%r is not safely callable' % (__obj,))
return __context.call(__obj, *args, **kwargs)
示例3: call
# 需要導入模塊: from jinja2 import exceptions [as 別名]
# 或者: from jinja2.exceptions import SecurityError [as 別名]
def call(__self, __context, __obj, *args, **kwargs):
"""Call an object from sandboxed code."""
fmt = inspect_format_method(__obj)
if fmt is not None:
return __self.format_string(fmt, args, kwargs)
# the double prefixes are to avoid double keyword argument
# errors when proxying the call.
if not __self.is_safe_callable(__obj):
raise SecurityError('%r is not safely callable' % (__obj,))
return __context.call(__obj, *args, **kwargs)
示例4: call
# 需要導入模塊: from jinja2 import exceptions [as 別名]
# 或者: from jinja2.exceptions import SecurityError [as 別名]
def call(__self, __context, __obj, *args, **kwargs):
"""Call an object from sandboxed code."""
# the double prefixes are to avoid double keyword argument
# errors when proxying the call.
if not __self.is_safe_callable(__obj):
raise SecurityError('%r is not safely callable' % (__obj,))
return __context.call(__obj, *args, **kwargs)