當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。