Closed gjost closed 8 years ago
Problem relates to how we populate Entity
objects, how we tell if they are modified (we don't want to write if they're not modified).
In ddrlocal
, the webui.views.entities.new
view has a horribly convoluted process, mainly due to the requirement that we get IDs from the ID service and that this happen in a single step:
settings.TEMPLATES_EJSON
to entity.path_abs
,DDR.commands.entitiy_create()
,entity.write_json()
,DDR.commands.entity_update()
,webui.views.entities.edit
.In DDR.batch_import.import_entities()
we have the following:
entity = eidentifier.object()
if not entity:
entity = models.Entity.create(eidentifier.path_abs(), eidentifier)
_populate_object(entity, module, field_names, field_directives, rowd)
if _object_writable(entity, field_names):
entity.write_json()
...
We need to see exactly what models.Entity.create
and batch_import._populate_object
are doing.
ddr-repo
to add CSV directives.ddr-repo
to add default values (or None
in the case of "id").
When updating existing Entities,
ddr-import entity
is setting important fields to empty values:record_created
->None
files
->[]
This is a destructive change! We cannot have this!