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