Skip to content

Commit

Permalink
Merge pull request #205 from uc-cdis/fix/storage-api
Browse files Browse the repository at this point in the history
fix(storage-api): fix to use fence restful api wrapper
  • Loading branch information
philloooo authored May 2, 2018
2 parents a0f560a + ed49c8d commit 3319210
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions fence/blueprints/storage_creds/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import flask
from flask_sqlalchemy_session import current_session
from flask_restful import Api

from fence.auth import require_auth_header
from fence.blueprints.storage_creds.api import AccessKey, ApiKey, ApiKeyList
Expand All @@ -9,6 +8,7 @@
from fence.blueprints.storage_creds.other import OtherCredentialsList
from fence.blueprints.storage_creds.other import OtherCredentials
from fence.resources.storage import get_endpoints_descriptions
from fence.restful import RestfulApi

ALL_RESOURCES = {
'/api': 'access to CDIS APIs',
Expand All @@ -21,7 +21,7 @@

def make_creds_blueprint():
blueprint = flask.Blueprint('credentials', __name__)
blueprint_api = Api(blueprint)
blueprint_api = RestfulApi(blueprint)

blueprint_api.add_resource(
GoogleCredentialsList, '/google', strict_slashes=False
Expand Down
7 changes: 6 additions & 1 deletion fence/restful.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ def handle_error(error):
return flask.jsonify(error.get_body()), error.status_code
else:
flask.current_app.logger.exception("Catch exception")
return flask.jsonify(error=error.message), 500
error_code = 500
if hasattr(error, 'code'):
error_code = error.code
elif hasattr(error, 'status_code'):
error_code = error.status_code
return flask.jsonify(error=error.message), error_code
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ pyyaml
-e git+https://github.com/uc-cdis/datamodelutils.git@0.3.0#egg=datamodelutils
-e git+https://github.com/uc-cdis/cdis-python-utils.git@0.2.8#egg=cdispyutils
-e git+https://github.com/uc-cdis/cirrus.git@0.0.4#egg=cirrus-0.0.4
-e git+https://github.com/uc-cdis/authutils.git@079981a809382a14e17f5af4749f50e56410a8ad#egg=authutils-2.0.0
-e git+https://github.com/uc-cdis/authutils.git@2.0.1#egg=authutils-2.0.1
2 changes: 1 addition & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


# WARNING: the test database is cleared every run
DB = 'postgresql://postgres:postgres@localhost:5432/fence_test_tmp'
DB = 'postgresql://postgres@localhost:5432/fence_test_tmp'

MOCK_AUTH = True

Expand Down

0 comments on commit 3319210

Please sign in to comment.