本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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()