本文整理匯總了Python中django.test.signals.template_rendered.disconnect方法的典型用法代碼示例。如果您正苦於以下問題:Python template_rendered.disconnect方法的具體用法?Python template_rendered.disconnect怎麽用?Python template_rendered.disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.test.signals.template_rendered
的用法示例。
在下文中一共展示了template_rendered.disconnect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __exit__
# 需要導入模塊: from django.test.signals import template_rendered [as 別名]
# 或者: from django.test.signals.template_rendered import disconnect [as 別名]
def __exit__(self, exc_type, exc_value, traceback):
template_rendered.disconnect(self.on_template_render)
if exc_type is not None:
return
if not self.test():
message = self.message()
if len(self.rendered_templates) == 0:
message += ' No template was rendered.'
else:
message += ' Following templates were rendered: %s' % (
', '.join(self.rendered_template_names))
self.test_case.fail(message)
示例2: __exit__
# 需要導入模塊: from django.test.signals import template_rendered [as 別名]
# 或者: from django.test.signals.template_rendered import disconnect [as 別名]
def __exit__(self, exc_type, exc_value, traceback):
template_rendered.disconnect(self.on_template_render)
if exc_type is not None:
return
if not self.test():
message = self.message()
if self.rendered_templates:
message += ' Following templates were rendered: %s' % (
', '.join(self.rendered_template_names)
)
else:
message += ' No template was rendered.'
self.test_case.fail(message)
示例3: __enter__
# 需要導入模塊: from django.test.signals import template_rendered [as 別名]
# 或者: from django.test.signals.template_rendered import disconnect [as 別名]
def __enter__(self):
self.old_debug_cursor = self.connection.use_debug_cursor
self.connection.use_debug_cursor = True
self.starting_queries = len(self.connection.queries)
request_started.disconnect(reset_queries)
return self