*: misc formatting cleanup
This commit is contained in:
parent
a42eb09a3e
commit
5fee4d6d19
2 changed files with 17 additions and 17 deletions
|
@ -31,6 +31,19 @@ license_validator.enforce_license_before_request(v2_bp)
|
||||||
time_blueprint(v2_bp, metric_queue)
|
time_blueprint(v2_bp, metric_queue)
|
||||||
|
|
||||||
|
|
||||||
|
@v2_bp.app_errorhandler(V2RegistryException)
|
||||||
|
def handle_registry_v2_exception(error):
|
||||||
|
response = jsonify({
|
||||||
|
'errors': [error.as_dict()]
|
||||||
|
})
|
||||||
|
|
||||||
|
response.status_code = error.http_status_code
|
||||||
|
if response.status_code == 401:
|
||||||
|
response.headers.extend(get_auth_headers(repository=error.repository, scopes=error.scopes))
|
||||||
|
logger.debug('sending response: %s', response.get_data())
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
_MAX_RESULTS_PER_PAGE = 50
|
_MAX_RESULTS_PER_PAGE = 50
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,19 +88,6 @@ def paginate(limit_kwarg_name='limit', offset_kwarg_name='offset',
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
@v2_bp.app_errorhandler(V2RegistryException)
|
|
||||||
def handle_registry_v2_exception(error):
|
|
||||||
response = jsonify({
|
|
||||||
'errors': [error.as_dict()]
|
|
||||||
})
|
|
||||||
|
|
||||||
response.status_code = error.http_status_code
|
|
||||||
if response.status_code == 401:
|
|
||||||
response.headers.extend(get_auth_headers(repository=error.repository, scopes=error.scopes))
|
|
||||||
logger.debug('sending response: %s', response.get_data())
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
def _require_repo_permission(permission_class, scopes=None, allow_public=False):
|
def _require_repo_permission(permission_class, scopes=None, allow_public=False):
|
||||||
def wrapper(func):
|
def wrapper(func):
|
||||||
@wraps(func)
|
@wraps(func)
|
||||||
|
@ -120,7 +120,6 @@ def get_input_stream(flask_request):
|
||||||
return flask_request.stream
|
return flask_request.stream
|
||||||
|
|
||||||
|
|
||||||
# TODO remove when v2 is deployed everywhere
|
|
||||||
def route_show_if(value):
|
def route_show_if(value):
|
||||||
def decorator(f):
|
def decorator(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
|
@ -132,6 +131,7 @@ def route_show_if(value):
|
||||||
return decorated_function
|
return decorated_function
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
@v2_bp.route('/')
|
@v2_bp.route('/')
|
||||||
@route_show_if(features.ADVERTISE_V2)
|
@route_show_if(features.ADVERTISE_V2)
|
||||||
@process_registry_jwt_auth()
|
@process_registry_jwt_auth()
|
||||||
|
|
Reference in a new issue