本文整理汇总了Python中mako.exceptions.NameConflictError方法的典型用法代码示例。如果您正苦于以下问题:Python exceptions.NameConflictError方法的具体用法?Python exceptions.NameConflictError怎么用?Python exceptions.NameConflictError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mako.exceptions
的用法示例。
在下文中一共展示了exceptions.NameConflictError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _set_with_template
# 需要导入模块: from mako import exceptions [as 别名]
# 或者: from mako.exceptions import NameConflictError [as 别名]
def _set_with_template(self, t):
self._with_template = t
illegal_names = t.reserved_names.intersection(self._data)
if illegal_names:
raise exceptions.NameConflictError(
"Reserved words passed to render(): %s"
% ", ".join(illegal_names)
)
示例2: _set_with_template
# 需要导入模块: from mako import exceptions [as 别名]
# 或者: from mako.exceptions import NameConflictError [as 别名]
def _set_with_template(self, t):
self._with_template = t
illegal_names = t.reserved_names.intersection(self._data)
if illegal_names:
raise exceptions.NameConflictError(
"Reserved words passed to render(): %s" %
", ".join(illegal_names))
示例3: test_names_on_context
# 需要导入模块: from mako import exceptions [as 别名]
# 或者: from mako.exceptions import NameConflictError [as 别名]
def test_names_on_context(self):
for name in ("context", "loop", "UNDEFINED", "STOP_RENDERING"):
assert_raises_message(
exceptions.NameConflictError,
r"Reserved words passed to render\(\): %s" % name,
Template("x").render,
**{name: "foo"}
)
示例4: test_names_in_template
# 需要导入模块: from mako import exceptions [as 别名]
# 或者: from mako.exceptions import NameConflictError [as 别名]
def test_names_in_template(self):
for name in ("context", "loop", "UNDEFINED", "STOP_RENDERING"):
assert_raises_message(
exceptions.NameConflictError,
r"Reserved words declared in template: %s" % name,
Template,
"<%% %s = 5 %%>" % name,
)
示例5: test_names_on_context
# 需要导入模块: from mako import exceptions [as 别名]
# 或者: from mako.exceptions import NameConflictError [as 别名]
def test_names_on_context(self):
for name in ('context', 'loop', 'UNDEFINED', 'STOP_RENDERING'):
assert_raises_message(
exceptions.NameConflictError,
r"Reserved words passed to render\(\): %s" % name,
Template("x").render, **{name:'foo'}
)
示例6: test_names_in_template
# 需要导入模块: from mako import exceptions [as 别名]
# 或者: from mako.exceptions import NameConflictError [as 别名]
def test_names_in_template(self):
for name in ('context', 'loop', 'UNDEFINED', 'STOP_RENDERING'):
assert_raises_message(
exceptions.NameConflictError,
r"Reserved words declared in template: %s" % name,
Template, "<%% %s = 5 %%>" % name
)