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


Python Request._set_extensions方法代码示例

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


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

示例1: _makeRequest

# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import _set_extensions [as 别名]
 def _makeRequest(self, config, environ={}):
     from pyramid.request import Request
     from pyramid.interfaces import IRequestExtensions
     request = Request(environ)
     request.registry = config.registry
     request._set_extensions(config.registry.getUtility(IRequestExtensions))
     return request
开发者ID:podhmo,项目名称:mokehehe,代码行数:9,代码来源:test_workflow.py

示例2: test_includeme

# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import _set_extensions [as 别名]
def test_includeme(testconfig, icons_dir):
    testconfig.get_settings()["icons_path"] = str(icons_dir)
    testconfig.include(pylf.icons)
    testconfig.commit()
    req_exts = testconfig.registry.queryUtility(IRequestExtensions)
    req = Request({})
    req._set_extensions(req_exts)
    assert hasattr(req, "icon_path")
    icon_path = req.icon_path
    assert icon_path((None, None)) == "/icons/unknown.png"
    assert icon_path(("text/plain", None)) == "/icons/text-plain.png"
开发者ID:MarcSchmitzer,项目名称:pylf,代码行数:13,代码来源:test_icons.py

示例3: test_directive_get_sockjs_manager

# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import _set_extensions [as 别名]
    def test_directive_get_sockjs_manager(self):
        self.config.include('pyramid_sockjs')

        request = Request(self._environ)
        request.registry = self.registry
        self.registry.notify(NewRequest(request))
        try:
            from pyramid.interfaces import IRequestExtensions
            extensions = self.registry.getUtility(IRequestExtensions)
            request._set_extensions(extensions)
        except ImportError:
            pass

        self.assertTrue(hasattr(request, 'get_sockjs_manager'))
开发者ID:DanMauger,项目名称:pyramid_sockjs,代码行数:16,代码来源:test_config.py

示例4: test_get_session_manager_unknown

# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import _set_extensions [as 别名]
    def test_get_session_manager_unknown(self):
        request = Request(self._environ)
        request.registry = self.registry
        self.registry.notify(NewRequest(request))
        try:
            from pyramid.interfaces import IRequestExtensions
            extensions = self.registry.getUtility(IRequestExtensions)
            request._set_extensions(extensions)
        except ImportError:
            pass

        self.assertRaises(
            KeyError, request.get_sockjs_manager, 'test')

        self.config.add_sockjs_route()
        self.assertRaises(
            KeyError, request.get_sockjs_manager, 'test')
开发者ID:DanMauger,项目名称:pyramid_sockjs,代码行数:19,代码来源:test_config.py

示例5: test_get_session_manager_default

# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import _set_extensions [as 别名]
    def test_get_session_manager_default(self):
        import pyramid_sockjs
        self.config.add_sockjs_route()

        request = Request(self._environ)
        request.registry = self.registry
        self.registry.notify(NewRequest(request))

        try:
            from pyramid.interfaces import IRequestExtensions
            extensions = self.registry.getUtility(IRequestExtensions)
            request._set_extensions(extensions)
        except ImportError:
            pass

        sm = request.get_sockjs_manager()
        self.assertIs(self.registry.__sockjs_managers__[''], sm)
开发者ID:DanMauger,项目名称:pyramid_sockjs,代码行数:19,代码来源:test_config.py

示例6: test_session_manager_route_url

# 需要导入模块: from pyramid.request import Request [as 别名]
# 或者: from pyramid.request.Request import _set_extensions [as 别名]
    def test_session_manager_route_url(self):
        import pyramid_sockjs

        name = 'example'
        self.config.add_sockjs_route(name, prefix='/chat-service')
        self.config.commit()

        request = Request(self._environ)
        request.registry = self.registry
        self.registry.notify(NewRequest(request))
        try:
            from pyramid.interfaces import IRequestExtensions
            extensions = self.registry.getUtility(IRequestExtensions)
            request._set_extensions(extensions)
        except ImportError:
            pass

        sm = request.get_sockjs_manager(name)
        self.assertEqual(
            sm.route_url(request), 'http://example.com/chat-service/')
开发者ID:DanMauger,项目名称:pyramid_sockjs,代码行数:22,代码来源:test_config.py


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