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


Python DebugToolbarMiddleware.process_request方法代码示例

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


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

示例1: test_tuple_urlconf

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
 def test_tuple_urlconf(self):
     request = rf.get('/')
     urls = __import__('tests.urls').urls
     urls.urlpatterns = tuple(urls.urlpatterns)
     request.urlconf = urls
     middleware = DebugToolbarMiddleware()
     with Settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True):
         middleware.process_request(request)
         self.assertFalse(isinstance(request.urlconf, basestring))
开发者ID:CLKUY,项目名称:django-debug-toolbar,代码行数:11,代码来源:tests.py

示例2: test_tuple_urlconf

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
    def test_tuple_urlconf(self):
        request = rf.get('/')
        urls = __import__('tests.urls').urls
        urls.urlpatterns = tuple(urls.urlpatterns)
        request.urlconf = urls
        middleware = DebugToolbarMiddleware()

        middleware.process_request(request)

        self.assertFalse(isinstance(request.urlconf, six.string_types))
开发者ID:nazyacom,项目名称:django-debug-toolbar,代码行数:12,代码来源:test_integration.py

示例3: test_request_urlconf_string

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
    def test_request_urlconf_string(self):
        request = rf.get('/')
        set_urlconf('tests.urls')
        middleware = DebugToolbarMiddleware()

        middleware.process_request(request)

        patterns = get_resolver(get_urlconf()).url_patterns
        self.assertTrue(hasattr(patterns[1], '_callback_str'))
        self.assertEqual(patterns[-1]._callback_str, 'tests.views.execute_sql')
开发者ID:nazyacom,项目名称:django-debug-toolbar,代码行数:12,代码来源:test_integration.py

示例4: test_request_urlconf_string

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
    def test_request_urlconf_string(self):
        request = rf.get('/')
        request.urlconf = 'tests.urls'
        middleware = DebugToolbarMiddleware()

        with Settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True):
            middleware.process_request(request)

            self.assertFalse(isinstance(request.urlconf, basestring))

            self.assertTrue(hasattr(request.urlconf.urlpatterns[1], '_callback_str'))
            self.assertEquals(request.urlconf.urlpatterns[-1]._callback_str, 'tests.views.execute_sql')
开发者ID:hane2009,项目名称:django-debug-toolbar,代码行数:14,代码来源:tests.py

示例5: test_request_urlconf_module

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
    def test_request_urlconf_module(self):
        request = rf.get('/')
        request.urlconf = __import__('tests.urls').urls
        middleware = DebugToolbarMiddleware()

        with self.settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True):
            middleware.process_request(request)

            self.assertFalse(isinstance(request.urlconf, six.string_types))

            self.assertTrue(hasattr(request.urlconf.urlpatterns[1], '_callback_str'))
            self.assertEqual(request.urlconf.urlpatterns[-1]._callback_str, 'tests.views.execute_sql')
开发者ID:gfzhao,项目名称:django-debug-toolbar,代码行数:14,代码来源:tests.py

示例6: test_request_urlconf_module

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
    def test_request_urlconf_module(self):
        request = rf.get('/')
        request.urlconf = __import__('tests.urls').urls
        middleware = DebugToolbarMiddleware()

        middleware.process_request(request)

        self.assertFalse(isinstance(request.urlconf, six.string_types))

        patterns = request.urlconf.urlpatterns
        self.assertTrue(hasattr(patterns[1], '_callback_str'))
        self.assertEqual(patterns[-1]._callback_str, 'tests.views.execute_sql')
开发者ID:nazyacom,项目名称:django-debug-toolbar,代码行数:14,代码来源:test_integration.py

示例7: test_request_urlconf_string

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
    def test_request_urlconf_string(self):
        request = self.request

        request.urlconf = 'debug_toolbar.tests.urls'
        request.META = {'REMOTE_ADDR': '127.0.0.1'}
        middleware = DebugToolbarMiddleware()

        with Settings(DEBUG=True):
            middleware.process_request(request)

            self.assertFalse(isinstance(request.urlconf, basestring))

            self.assertTrue(hasattr(request.urlconf.urlpatterns[0], '_callback_str'))
            self.assertEquals(request.urlconf.urlpatterns[0]._callback_str, 'debug_toolbar.views.debug_media')
            self.assertEquals(request.urlconf.urlpatterns[-1].urlconf_name.__name__, 'debug_toolbar.tests.urls')
开发者ID:Torkn,项目名称:django-debug-toolbar,代码行数:17,代码来源:tests.py

示例8: test_request_urlconf_string

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
    def test_request_urlconf_string(self):
        request = self.request

        request.urlconf = "tests.urls"
        request.META = {"REMOTE_ADDR": "127.0.0.1"}
        middleware = DebugToolbarMiddleware()

        with Settings(INTERNAL_IPS=["127.0.0.1"], DEBUG=True):
            middleware.process_request(request)

            self.assertFalse(isinstance(request.urlconf, basestring))

            self.assertTrue(hasattr(request.urlconf.urlpatterns[0], "_callback_str"))
            self.assertEquals(request.urlconf.urlpatterns[0]._callback_str, "debug_toolbar.views.debug_media")
            self.assertEquals(request.urlconf.urlpatterns[-1].urlconf_name.__name__, "tests.urls")
开发者ID:jasonkeene,项目名称:django-debug-toolbar,代码行数:17,代码来源:tests.py

示例9: test_request_urlconf_module

# 需要导入模块: from debug_toolbar.middleware import DebugToolbarMiddleware [as 别名]
# 或者: from debug_toolbar.middleware.DebugToolbarMiddleware import process_request [as 别名]
 def test_request_urlconf_module(self):
     request = self.request
     
     request.urlconf = __import__('tests.urls').urls
     request.META = {'REMOTE_ADDR': '127.0.0.1'}
     middleware = DebugToolbarMiddleware()
     
     with Settings(INTERNAL_IPS=['127.0.0.1'], DEBUG=True):
         middleware.process_request(request)
         
         self.assertFalse(isinstance(request.urlconf, basestring))
         
         self.assertTrue(hasattr(request.urlconf.urlpatterns[0], '_callback_str'))
         self.assertEquals(request.urlconf.urlpatterns[0]._callback_str, 'debug_toolbar.views.debug_media')
         self.assertTrue(hasattr(request.urlconf.urlpatterns[1], '_callback_str'))
         self.assertEquals(request.urlconf.urlpatterns[-1]._callback_str, 'tests.views.execute_sql')
开发者ID:hakanw,项目名称:django-debug-toolbar,代码行数:18,代码来源:tests.py


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