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


Python _request_ctx_stack.pop方法代码示例

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


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

示例1: open

# 需要导入模块: from flask import _request_ctx_stack [as 别名]
# 或者: from flask._request_ctx_stack import pop [as 别名]
def open(self, *args, **kwargs):
        as_tuple = kwargs.pop('as_tuple', False)
        buffered = kwargs.pop('buffered', False)
        follow_redirects = kwargs.pop('follow_redirects', False)

        if (
            not kwargs and len(args) == 1
            and isinstance(args[0], (EnvironBuilder, dict))
        ):
            environ = self.environ_base.copy()

            if isinstance(args[0], EnvironBuilder):
                environ.update(args[0].get_environ())
            else:
                environ.update(args[0])

            environ['flask._preserve_context'] = self.preserve_context
        else:
            kwargs.setdefault('environ_overrides', {}) \
                ['flask._preserve_context'] = self.preserve_context
            kwargs.setdefault('environ_base', self.environ_base)
            builder = make_test_environ_builder(
                self.application, *args, **kwargs
            )

            try:
                environ = builder.get_environ()
            finally:
                builder.close()

        return Client.open(
            self, environ,
            as_tuple=as_tuple,
            buffered=buffered,
            follow_redirects=follow_redirects
        ) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:38,代码来源:testing.py

示例2: __exit__

# 需要导入模块: from flask import _request_ctx_stack [as 别名]
# 或者: from flask._request_ctx_stack import pop [as 别名]
def __exit__(self, exc_type, exc_value, tb):
        self.preserve_context = False

        # on exit we want to clean up earlier.  Normally the request context
        # stays preserved until the next request in the same thread comes
        # in.  See RequestGlobals.push() for the general behavior.
        top = _request_ctx_stack.top
        if top is not None and top.preserved:
            top.pop() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:11,代码来源:testing.py

示例3: open

# 需要导入模块: from flask import _request_ctx_stack [as 别名]
# 或者: from flask._request_ctx_stack import pop [as 别名]
def open(self, *args, **kwargs):
        kwargs.setdefault('environ_overrides', {}) \
            ['flask._preserve_context'] = self.preserve_context

        as_tuple = kwargs.pop('as_tuple', False)
        buffered = kwargs.pop('buffered', False)
        follow_redirects = kwargs.pop('follow_redirects', False)
        builder = make_test_environ_builder(self.application, *args, **kwargs)

        return Client.open(self, builder,
                           as_tuple=as_tuple,
                           buffered=buffered,
                           follow_redirects=follow_redirects) 
开发者ID:jpush,项目名称:jbox,代码行数:15,代码来源:testing.py

示例4: open

# 需要导入模块: from flask import _request_ctx_stack [as 别名]
# 或者: from flask._request_ctx_stack import pop [as 别名]
def open(self, *args, **kwargs):
        kwargs.setdefault('environ_overrides', {}) \
            ['flask._preserve_context'] = self.preserve_context
        kwargs.setdefault('environ_base', self.environ_base)

        as_tuple = kwargs.pop('as_tuple', False)
        buffered = kwargs.pop('buffered', False)
        follow_redirects = kwargs.pop('follow_redirects', False)
        builder = make_test_environ_builder(self.application, *args, **kwargs)

        return Client.open(self, builder,
                           as_tuple=as_tuple,
                           buffered=buffered,
                           follow_redirects=follow_redirects) 
开发者ID:liantian-cn,项目名称:RSSNewsGAE,代码行数:16,代码来源:testing.py

示例5: pop_ctx

# 需要导入模块: from flask import _request_ctx_stack [as 别名]
# 或者: from flask._request_ctx_stack import pop [as 别名]
def pop_ctx():
    """Removes the test context(s) from the current stack(s)
    """
    if getattr(_request_ctx_stack.top, 'fixtures_request_context', False):
        _request_ctx_stack.pop()
    if _app_ctx_stack is not None and getattr(_app_ctx_stack.top, 'fixtures_app_context', False):
        _app_ctx_stack.pop() 
开发者ID:croach,项目名称:Flask-Fixtures,代码行数:9,代码来源:__init__.py

示例6: open

# 需要导入模块: from flask import _request_ctx_stack [as 别名]
# 或者: from flask._request_ctx_stack import pop [as 别名]
def open(self, *args, **kwargs):
        if self.context_preserved:
            _request_ctx_stack.pop()
            self.context_preserved = False
        kwargs.setdefault('environ_overrides', {}) \
            ['flask._preserve_context'] = self.preserve_context
        old = _request_ctx_stack.top
        try:
            return Client.open(self, *args, **kwargs)
        finally:
            self.context_preserved = _request_ctx_stack.top is not old 
开发者ID:hhstore,项目名称:annotated-py-projects,代码行数:13,代码来源:testing.py

示例7: __exit__

# 需要导入模块: from flask import _request_ctx_stack [as 别名]
# 或者: from flask._request_ctx_stack import pop [as 别名]
def __exit__(self, exc_type, exc_value, tb):
        self.preserve_context = False
        if self.context_preserved:
            _request_ctx_stack.pop() 
开发者ID:hhstore,项目名称:annotated-py-projects,代码行数:6,代码来源:testing.py


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