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


Python Configurator.manager方法代码示例

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


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

示例1: test_end

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import manager [as 别名]
    def test_end(self):
        from pyramid.config import Configurator

        config = Configurator()
        manager = DummyThreadLocalManager()
        pushed = manager.pushed
        config.manager = manager
        config.end()
        self.assertEqual(manager.pushed, pushed)
        self.assertEqual(manager.popped, True)
开发者ID:Pylons,项目名称:pyramid,代码行数:12,代码来源:test_init.py

示例2: test_begin

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import manager [as 别名]
    def test_begin(self):
        from pyramid.config import Configurator

        config = Configurator()
        manager = DummyThreadLocalManager()
        config.manager = manager
        config.begin()
        self.assertEqual(
            manager.pushed, {'registry': config.registry, 'request': None}
        )
        self.assertEqual(manager.popped, False)
开发者ID:Pylons,项目名称:pyramid,代码行数:13,代码来源:test_init.py

示例3: test_begin_with_request

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import manager [as 别名]
    def test_begin_with_request(self):
        from pyramid.config import Configurator

        config = Configurator()
        request = object()
        manager = DummyThreadLocalManager()
        config.manager = manager
        config.begin(request=request)
        self.assertEqual(
            manager.pushed, {'registry': config.registry, 'request': request}
        )
        self.assertEqual(manager.popped, False)
开发者ID:Pylons,项目名称:pyramid,代码行数:14,代码来源:test_init.py

示例4: test_begin_does_not_propagate_request_for_diff_registry

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import manager [as 别名]
    def test_begin_does_not_propagate_request_for_diff_registry(self):
        from pyramid.config import Configurator

        config = Configurator()
        manager = DummyThreadLocalManager()
        req = object()
        pushed = {'registry': object(), 'request': req}
        manager.pushed = pushed
        config.manager = manager
        config.begin()
        self.assertTrue(manager.pushed is not pushed)
        self.assertEqual(manager.pushed['request'], None)
        self.assertEqual(manager.pushed['registry'], config.registry)
开发者ID:Pylons,项目名称:pyramid,代码行数:15,代码来源:test_init.py

示例5: test_begin_overrides_request

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import manager [as 别名]
    def test_begin_overrides_request(self):
        from pyramid.config import Configurator

        config = Configurator()
        manager = DummyThreadLocalManager()
        req = object()
        # set it up for auto-propagation
        pushed = {'registry': config.registry, 'request': None}
        manager.pushed = pushed
        config.manager = manager
        config.begin(req)
        self.assertTrue(manager.pushed is not pushed)
        self.assertEqual(manager.pushed['request'], req)
        self.assertEqual(manager.pushed['registry'], config.registry)
开发者ID:Pylons,项目名称:pyramid,代码行数:16,代码来源:test_init.py

示例6: test_context_manager

# 需要导入模块: from pyramid.config import Configurator [as 别名]
# 或者: from pyramid.config.Configurator import manager [as 别名]
    def test_context_manager(self):
        from pyramid.config import Configurator

        config = Configurator()
        manager = DummyThreadLocalManager()
        config.manager = manager
        view = lambda r: None
        with config as ctx:
            self.assertTrue(config is ctx)
            self.assertEqual(
                manager.pushed, {'registry': config.registry, 'request': None}
            )
            self.assertFalse(manager.popped)
            config.add_view(view)
        self.assertTrue(manager.popped)
        config.add_view(view)  # did not raise a conflict because of commit
        config.commit()
开发者ID:Pylons,项目名称:pyramid,代码行数:19,代码来源:test_init.py


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