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