Beispiel #1
0
def update_domain(domain_id):
    context = flask.request.environ.get('context')
    values = flask.request.json

    try:
        domain_schema.validate(values)
        domain = central_api.update_domain(context, domain_id, values)
    except exceptions.Forbidden:
        return flask.Response(status=401)
    except exceptions.InvalidObject, e:
        return flask.Response(status=400, response=str(e))
Beispiel #2
0
def update_domain(domain_id):
    context = flask.request.environ.get('context')
    values = flask.request.json

    try:
        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)
    except exceptions.InvalidObject, e:
        response_body = json.dumps({'errors': e.errors})
        return flask.Response(status=400, response=response_body)