denshoproject / ddr-cmdln

Command-line tools for automating the Densho Digital Repository's various processes.
Other
0 stars 2 forks source link

ddr-import entity sets important values (e.g. record_created) no None #28

Closed gjost closed 8 years ago

gjost commented 8 years ago

When updating existing Entities, ddr-import entity is setting important fields to empty values:

This is a destructive change! We cannot have this!

gjost commented 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:

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.

gjost commented 8 years ago