Ensure partial API updates are validated correctly

Change-Id: Id8123a780131989e5a0f36da478c3d34e21db209
This commit is contained in:
Kiall Mac Innes 2012-12-11 07:12:10 -08:00
parent cecd0f43bb
commit 14ec287902
3 changed files with 12 additions and 3 deletions

View File

@ -98,7 +98,10 @@ def update_domain(domain_id):
values = flask.request.json
try:
domain_schema.validate(values)
domain = central_api.get_domain(context, domain_id)
domain.update(values)
domain_schema.validate(domain)
domain = central_api.update_domain(context, domain_id, values)
except exceptions.Forbidden:
return flask.Response(status=401)

View File

@ -98,7 +98,10 @@ def update_record(domain_id, record_id):
values = flask.request.json
try:
record_schema.validate(values)
record = central_api.get_record(context, domain_id, record_id)
record.update(values)
record_schema.validate(record)
record = central_api.update_record(context, domain_id, record_id,
values)
except exceptions.Forbidden:

View File

@ -97,7 +97,10 @@ def update_server(server_id):
values = flask.request.json
try:
server_schema.validate(values)
server = central_api.get_server(context, server_id)
server.update(values)
server_schema.validate(server)
server = central_api.update_server(context, server_id, values=values)
except exceptions.Forbidden:
return flask.Response(status=401)