Skip to content
This repository was archived by the owner on May 28, 2022. It is now read-only.

Commit fef34d8

Browse files
Fixes some issues with endpoints.
1 parent c643f03 commit fef34d8

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/freeseer/frontend/controller/configuration.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
from flask import Blueprint, request
2828
from freeseer import settings, logging
29+
from freeseer.framework.config.exceptions import InvalidOptionValueError
2930
from freeseer.frontend.controller.server import http_response, HTTPError
3031

3132
log = logging.getLogger(__name__)
@@ -69,7 +70,7 @@ def teardown_configuration(signum, frame):
6970
# Profile endpoints
7071
#
7172

72-
@configuration.route('/profiles/', methods=['GET'])
73+
@configuration.route('/profiles', methods=['GET'])
7374
@http_response(200)
7475
def list_profiles():
7576
"""
@@ -90,7 +91,7 @@ def view_profile(profile):
9091
return {'profile_configuration': config.values}
9192

9293

93-
@configuration.route('/profiles/', methods=['POST'])
94+
@configuration.route('/profiles', methods=['POST'])
9495
@http_response(200)
9596
def create_profile():
9697
"""
@@ -122,8 +123,13 @@ def modify_profile(profile):
122123
config = load_configuration(profile)
123124
changes = request.form
124125
for key, value in changes.items():
125-
setattr(config, key, value)
126-
configuration.save()
126+
try:
127+
setattr(config, key, value)
128+
except InvalidOptionValueError:
129+
raise HTTPError('Invalid Argument', 400)
130+
131+
config.save()
132+
return ''
127133

128134
#
129135
# End Profile Endpoints

0 commit comments

Comments
 (0)