Python flask.globals.request.blueprint() Examples
The following are 11
code examples of flask.globals.request.blueprint().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
flask.globals.request
, or try the search function
.
Example #1
Source File: __init__.py From recruit with Apache License 2.0 | 6 votes |
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)
Example #2
Source File: __init__.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
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)
Example #3
Source File: __init__.py From Building-Recommendation-Systems-with-Python with MIT License | 6 votes |
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)
Example #4
Source File: __init__.py From scylla with Apache License 2.0 | 6 votes |
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)
Example #5
Source File: __init__.py From scout_apm_python with MIT License | 6 votes |
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()
Example #6
Source File: __init__.py From android_universal with MIT License | 6 votes |
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)
Example #7
Source File: __init__.py From recruit with Apache License 2.0 | 5 votes |
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)
Example #8
Source File: __init__.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
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)
Example #9
Source File: __init__.py From Building-Recommendation-Systems-with-Python with MIT License | 5 votes |
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)
Example #10
Source File: __init__.py From scylla with Apache License 2.0 | 5 votes |
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)
Example #11
Source File: __init__.py From android_universal with MIT License | 5 votes |
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)