本文整理匯總了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
)