本文整理汇总了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)