• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pinning.this_thread_is_pinned函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中multidb.pinning.this_thread_is_pinned函数的典型用法代码示例。如果您正苦于以下问题:Python this_thread_is_pinned函数的具体用法?Python this_thread_is_pinned怎么用?Python this_thread_is_pinned使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_pinning_encapsulation

 def test_pinning_encapsulation(self):
     """Check the pinning getters and setters."""
     self.assertFalse(this_thread_is_pinned())
     pin_this_thread()
     self.assertTrue(this_thread_is_pinned())
     unpin_this_thread()
     self.assertFalse(this_thread_is_pinned())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:7,代码来源:test_all.py


示例2: test_decorator_resets

 def test_decorator_resets(self):
     @use_master
     def check():
         assert this_thread_is_pinned()
     pin_this_thread()
     assert this_thread_is_pinned()
     check()
     assert this_thread_is_pinned()
开发者ID:mapmyfitness,项目名称:django-multidb-router,代码行数:8,代码来源:__init__.py


示例3: test_decorator_resets

 def test_decorator_resets(self):
     @use_primary_db
     def check():
         assert this_thread_is_pinned()
     pin_this_thread()
     assert this_thread_is_pinned()
     check()
     assert this_thread_is_pinned()
开发者ID:jbalogh,项目名称:django-multidb-router,代码行数:8,代码来源:tests.py


示例4: test_decorator

 def test_decorator(self):
     @use_primary_db
     def check():
         assert this_thread_is_pinned()
     unpin_this_thread()
     assert not this_thread_is_pinned()
     check()
     assert not this_thread_is_pinned()
开发者ID:jbalogh,项目名称:django-multidb-router,代码行数:8,代码来源:tests.py


示例5: test_context_manager_exception

 def test_context_manager_exception(self):
     unpin_this_thread()
     self.assertFalse(this_thread_is_pinned())
     with self.assertRaises(ValueError):
         with use_master:
             self.assertTrue(this_thread_is_pinned())
             raise ValueError
     self.assertFalse(this_thread_is_pinned())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:8,代码来源:test_all.py


示例6: test_decorator

 def test_decorator(self):
     @use_master
     def check():
         assert this_thread_is_pinned()
     unpin_this_thread()
     assert not this_thread_is_pinned()
     check()
     assert not this_thread_is_pinned()
开发者ID:mapmyfitness,项目名称:django-multidb-router,代码行数:8,代码来源:__init__.py


示例7: test_context_manager_exception

 def test_context_manager_exception(self):
     unpin_this_thread()
     assert not this_thread_is_pinned()
     with self.assertRaises(ValueError):
         with use_master:
             assert this_thread_is_pinned()
             raise ValueError
     assert not this_thread_is_pinned()
开发者ID:mapmyfitness,项目名称:django-multidb-router,代码行数:8,代码来源:__init__.py


示例8: test_pinning_encapsulation

    def test_pinning_encapsulation(self):
        """Check the pinning getters and setters."""
        assert not this_thread_is_pinned(), "Thread started out pinned or this_thread_is_pinned() is broken."

        pin_this_thread()
        assert this_thread_is_pinned(), "pin_this_thread() didn't pin the thread."

        unpin_this_thread()
        assert not this_thread_is_pinned(), "Thread remained pinned after unpin_this_thread()."
开发者ID:Mondego,项目名称:pyreco,代码行数:9,代码来源:allPythonContent.py


示例9: test_context_manager_exception

 def test_context_manager_exception(self):
     unpin_this_thread()
     try:
         assert not this_thread_is_pinned()
         with use_master:
             assert this_thread_is_pinned()
             raise ValueError
     except ValueError:
         pass
     assert not this_thread_is_pinned()
开发者ID:Marlburo,项目名称:inventory,代码行数:10,代码来源:__init__.py


示例10: test_decorator_resets

    def test_decorator_resets(self):

        @use_master
        def check():
            self.assertTrue(this_thread_is_pinned())

        pin_this_thread()
        self.assertTrue(this_thread_is_pinned())
        check()
        self.assertTrue(this_thread_is_pinned())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py


示例11: test_decorator

    def test_decorator(self):

        @use_master
        def check():
            self.assertTrue(this_thread_is_pinned())

        unpin_this_thread()
        self.assertFalse(this_thread_is_pinned())
        check()
        self.assertFalse(this_thread_is_pinned())
开发者ID:wikical,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py


示例12: test_slave_decorator

    def test_slave_decorator(self):

        @use_slave
        def check():
            self.assertFalse(this_thread_is_pinned())

        pin_this_thread()
        self.assertTrue(this_thread_is_pinned())
        check()
        self.assertTrue(this_thread_is_pinned())
开发者ID:clearcare,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py


示例13: test_slave_decorator_resets

    def test_slave_decorator_resets(self):

        @use_slave
        def check():
            self.assertFalse(this_thread_is_pinned())

        unpin_this_thread()
        self.assertFalse(this_thread_is_pinned())
        check()
        self.assertFalse(this_thread_is_pinned())
开发者ID:clearcare,项目名称:django-multidb-router,代码行数:10,代码来源:test_all.py


示例14: test_failed_session_auth

 def test_failed_session_auth(self):
     req = RequestFactory().post(
         '/',
         HTTP_AUTHORIZATION='mkt-shared-secret bogus')
     ok_(not self.auth.is_authenticated(req))
     assert not getattr(req, 'amo_user', None)
     ok_(not this_thread_is_pinned())
开发者ID:aricha,项目名称:zamboni,代码行数:7,代码来源:test_authentication.py


示例15: test_request_token_fake

 def test_request_token_fake(self):
     c = Mock()
     c.key = self.access.key
     c.secret = 'mom'
     ok_(not self.auth.authenticate(
         Request(self.call(client=OAuthClient(c)))))
     ok_(not this_thread_is_pinned())
开发者ID:aricha,项目名称:zamboni,代码行数:7,代码来源:test_authentication.py


示例16: thread2_worker

        def thread2_worker():
            pin_this_thread()
            with use_primary_db:
                orchestrator.release()
                thread2_lock.acquire()

            pinned[2] = this_thread_is_pinned()
            orchestrator.release()
开发者ID:jbalogh,项目名称:django-multidb-router,代码行数:8,代码来源:tests.py


示例17: test_session_auth_query_disabled

 def test_session_auth_query_disabled(self):
     req = RequestFactory().post('/[email protected],56b6f1a3dd735d962c56'
                                 'ce7d8f46e02ec1d4748d2c00c407d75f0969d08bb'
                                 '9c68c31b3371aa8130317815c89e5072e31bb94b4'
                                 '121c5c165f3515838d4d6c60c4,165d631d3c3045'
                                 '458b4516242dad7ae')
     ok_(not self.auth.is_authenticated(req))
     ok_(not this_thread_is_pinned())
开发者ID:aricha,项目名称:zamboni,代码行数:8,代码来源:test_authentication.py


示例18: test_session_auth_query

 def test_session_auth_query(self):
     self.create_switch('shared-secret-in-url')
     req = RequestFactory().post('/[email protected],56b6f1a3dd735d962c56'
                                 'ce7d8f46e02ec1d4748d2c00c407d75f0969d08bb'
                                 '9c68c31b3371aa8130317815c89e5072e31bb94b4'
                                 '121c5c165f3515838d4d6c60c4,165d631d3c3045'
                                 '458b4516242dad7ae')
     ok_(self.auth.is_authenticated(req))
     eq_(self.profile.user.pk, req.amo_user.pk)
     ok_(this_thread_is_pinned())
开发者ID:aricha,项目名称:zamboni,代码行数:10,代码来源:test_authentication.py


示例19: process_response

    def process_response(self, request, response):
        if not getattr(request, 'API', False):
            return (super(APIPinningMiddleware, self)
                    .process_response(request, response))

        response['API-Pinned'] = str(this_thread_is_pinned())

        if (request.user and not request.user.is_anonymous() and (
                request.method in ['DELETE', 'PATCH', 'POST', 'PUT'] or
                getattr(response, '_db_write', False))):
            cache.set(self.cache_key(request), 1, PINNING_SECONDS)

        return response
开发者ID:MaxMillion,项目名称:zamboni,代码行数:13,代码来源:middleware.py


示例20: process_response

    def process_response(self, request, response):
        if not getattr(request, "API", False):
            return super(APIPinningMiddleware, self).process_response(request, response)

        response["API-Pinned"] = str(this_thread_is_pinned())

        if (
            request.user
            and not request.user.is_anonymous()
            and (request.method in ["DELETE", "PATCH", "POST", "PUT"] or getattr(response, "_db_write", False))
        ):
            cache.set(self.cache_key(request), 1, PINNING_SECONDS)

        return response
开发者ID:cvan,项目名称:zamboni,代码行数:14,代码来源:middleware.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pinning.unpin_this_thread函数代码示例发布时间:2022-05-27
下一篇:
Python pinning.pin_this_thread函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap