当前位置: 首页>>代码示例>>Python>>正文


Python request_started.connect方法代码示例

本文整理汇总了Python中django.core.signals.request_started.connect方法的典型用法代码示例。如果您正苦于以下问题:Python request_started.connect方法的具体用法?Python request_started.connect怎么用?Python request_started.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在django.core.signals.request_started的用法示例。


在下文中一共展示了request_started.connect方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __exit__

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def __exit__(self, exc_type, exc_value, traceback):
        self.connection.force_debug_cursor = self.force_debug_cursor
        request_started.connect(reset_queries)
        if exc_type is not None:
            return
        self.final_queries = len(self.connection.queries_log) 
开发者ID:lanbing510,项目名称:GTDWeb,代码行数:8,代码来源:utils.py

示例2: __exit__

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def __exit__(self, exc_type, exc_value, traceback):
        self.connection.use_debug_cursor = self.old_debug_cursor
        request_started.connect(reset_queries)
        if exc_type is not None:
            return

        final_queries = len(self.connection.queries)
        executed = final_queries - self.starting_queries

        self.test_case.assertEqual(
            executed, self.num, "%d queries executed, %d expected" % (
                executed, self.num
            )
        ) 
开发者ID:blackye,项目名称:luscan-devel,代码行数:16,代码来源:testcases.py

示例3: __enter__

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def __enter__(self):
        template_rendered.connect(self.on_template_render)
        return self 
开发者ID:blackye,项目名称:luscan-devel,代码行数:5,代码来源:testcases.py

示例4: register_handlers

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def register_handlers(client):
    from django.core.signals import got_request_exception, request_started, request_finished
    from elasticapm.contrib.django.handlers import exception_handler

    # Connect to Django's internal signal handlers
    got_request_exception.disconnect(dispatch_uid=ERROR_DISPATCH_UID)
    got_request_exception.connect(partial(exception_handler, client), dispatch_uid=ERROR_DISPATCH_UID, weak=False)

    request_started.disconnect(dispatch_uid=REQUEST_START_DISPATCH_UID)
    request_started.connect(
        partial(_request_started_handler, client), dispatch_uid=REQUEST_START_DISPATCH_UID, weak=False
    )

    request_finished.disconnect(dispatch_uid=REQUEST_FINISH_DISPATCH_UID)
    request_finished.connect(
        lambda sender, **kwargs: client.end_transaction() if _should_start_transaction(client) else None,
        dispatch_uid=REQUEST_FINISH_DISPATCH_UID,
        weak=False,
    )

    # If we can import celery, register ourselves as exception handler
    try:
        import celery  # noqa F401
        from elasticapm.contrib.celery import register_exception_tracking

        try:
            register_exception_tracking(client)
        except Exception as e:
            client.logger.exception("Failed installing django-celery hook: %s" % e)
    except ImportError:
        client.logger.debug("Not instrumenting Celery, couldn't import") 
开发者ID:elastic,项目名称:apm-agent-python,代码行数:33,代码来源:apps.py

示例5: ready

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def ready(self):
        request_started.connect(check_apps_need_reloading) 
开发者ID:propublica,项目名称:django-collaborative,代码行数:4,代码来源:apps.py

示例6: tearDown

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def tearDown(self):
        request_started.connect(close_old_connections) 
开发者ID:nesdis,项目名称:djongo,代码行数:4,代码来源:tests.py

示例7: setUp

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def setUp(self):
        self.signals = []
        self.signaled_environ = None
        request_started.connect(self.register_started)
        request_finished.connect(self.register_finished) 
开发者ID:nesdis,项目名称:djongo,代码行数:7,代码来源:tests.py

示例8: __exit__

# 需要导入模块: from django.core.signals import request_started [as 别名]
# 或者: from django.core.signals.request_started import connect [as 别名]
def __exit__(self, exc_type, exc_value, traceback):
        self.connection.force_debug_cursor = self.force_debug_cursor
        request_started.connect(reset_queries)
        if exc_type is not None:
            return
        final_count = len(self.connection.queries)
        self.num_queries = final_count - self.starting_count 
开发者ID:maas,项目名称:maas,代码行数:9,代码来源:djangotestcase.py


注:本文中的django.core.signals.request_started.connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。