Commit 86a5984d authored by Denis Laxalde's avatar Denis Laxalde
Browse files

Rename mapper variable in create_entity() API view

`etype_mapper` is not appropriate since the mapper bound to
ETypeResource is actually a "jsonschema.collection" mapper.
parent 68824684174a
......@@ -129,10 +129,10 @@ def create_entity(context, request):
# TODO In case of validation errors, it'd be better to give a JSON Schema
# entry as a "pointer", would require selection context to be an
# ETypeSchemaResource.
etype_mapper = context.mapper(CREATION_ROLE)
mapper = context.mapper(CREATION_ROLE)
instance = request.json_body
values = etype_mapper.values(instance)
entity = request.cw_cnx.create_entity(etype_mapper.etype, **values)
values = mapper.values(instance)
entity = request.cw_cnx.create_entity(mapper.etype, **values)
request.cw_cnx.commit()
LOG.info('created %s', entity)
return _created(request, context[entity.eid])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment