artefactual/archivematica — pull request #95 by mistydemeo (2014-08-16 01:27:58+00:00)
Title: Unify Unit ReplacementDict creation code

In the past, each Unit class had its own logic for creating replacementDicts. This meant that the available unit variables for a given job was dependent on the type of unit class that was spawning the job, and introduced the possibility of other inconsistencies.

For Archivematica 1.2, a new constructor for ReplacementDict had already been created which used the database to populate a common set of fields; this is used by every other place in Archivematica that creates and consumes ReplacementDicts for this kind of task, including every client script (normalization, identification, etc.)

The File unit is the only unit which retains its original constructor, and only as a backup. The new constructor depends on the database, but the File unit has to spawn several jobs before files are ever added to the database. The old minimalistic ReplacementDict is kept as a fallback for this case only; as soon as every file is assigned a UUID, the new ReplacementDict can be used.

refs #6451