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


Python request.blueprint方法代码示例

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


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

示例1: _dump_arg_defaults

# 需要导入模块: from flask.globals import request [as 别名]
# 或者: from flask.globals.request import blueprint [as 别名]
def _dump_arg_defaults(kwargs):
    """Inject default arguments for dump functions."""
    if current_app:
        bp = current_app.blueprints.get(request.blueprint) if request else None
        kwargs.setdefault(
            'cls',
            bp.json_encoder if bp and bp.json_encoder
                else current_app.json_encoder
        )

        if not current_app.config['JSON_AS_ASCII']:
            kwargs.setdefault('ensure_ascii', False)

        kwargs.setdefault('sort_keys', current_app.config['JSON_SORT_KEYS'])
    else:
        kwargs.setdefault('sort_keys', True)
        kwargs.setdefault('cls', JSONEncoder) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:19,代码来源:__init__.py

示例2: _dump_arg_defaults

# 需要导入模块: from flask.globals import request [as 别名]
# 或者: from flask.globals.request import blueprint [as 别名]
def _dump_arg_defaults(kwargs, app=None):
    """Inject default arguments for dump functions."""
    if app is None:
        app = current_app

    if app:
        bp = app.blueprints.get(request.blueprint) if request else None
        kwargs.setdefault(
            'cls', bp.json_encoder if bp and bp.json_encoder else app.json_encoder
        )

        if not app.config['JSON_AS_ASCII']:
            kwargs.setdefault('ensure_ascii', False)

        kwargs.setdefault('sort_keys', app.config['JSON_SORT_KEYS'])
    else:
        kwargs.setdefault('sort_keys', True)
        kwargs.setdefault('cls', JSONEncoder) 
开发者ID:PacktPublishing,项目名称:Building-Recommendation-Systems-with-Python,代码行数:20,代码来源:__init__.py

示例3: wrapped_preprocess_request

# 需要导入模块: from flask.globals import request [as 别名]
# 或者: from flask.globals.request import blueprint [as 别名]
def wrapped_preprocess_request(self, wrapped, instance, args, kwargs):
        tracked_request = getattr(request, "_scout_tracked_request", None)
        if tracked_request is None:
            return wrapped(*args, **kwargs)

        # Unlike middleware in other frameworks, using request preprocessors is
        # less common in Flask, so only add a span if there is any in use
        have_before_request_funcs = (
            None in instance.before_request_funcs
            or request.blueprint in instance.before_request_funcs
        )
        if not have_before_request_funcs:
            return wrapped(*args, **kwargs)

        tracked_request.start_span("PreprocessRequest", should_capture_backtrace=False)
        try:
            return wrapped(*args, **kwargs)
        finally:
            tracked_request.stop_span() 
开发者ID:scoutapp,项目名称:scout_apm_python,代码行数:21,代码来源:__init__.py

示例4: _load_arg_defaults

# 需要导入模块: from flask.globals import request [as 别名]
# 或者: from flask.globals.request import blueprint [as 别名]
def _load_arg_defaults(kwargs):
    """Inject default arguments for load functions."""
    if current_app:
        bp = current_app.blueprints.get(request.blueprint) if request else None
        kwargs.setdefault(
            'cls',
            bp.json_decoder if bp and bp.json_decoder
                else current_app.json_decoder
        )
    else:
        kwargs.setdefault('cls', JSONDecoder) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:__init__.py

示例5: _load_arg_defaults

# 需要导入模块: from flask.globals import request [as 别名]
# 或者: from flask.globals.request import blueprint [as 别名]
def _load_arg_defaults(kwargs, app=None):
    """Inject default arguments for load functions."""
    if app is None:
        app = current_app

    if app:
        bp = app.blueprints.get(request.blueprint) if request else None
        kwargs.setdefault(
            'cls',
            bp.json_decoder if bp and bp.json_decoder
                else app.json_decoder
        )
    else:
        kwargs.setdefault('cls', JSONDecoder) 
开发者ID:PacktPublishing,项目名称:Building-Recommendation-Systems-with-Python,代码行数:16,代码来源:__init__.py


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