diff --git a/transformer/mappings.py b/transformer/mappings.py index beca043..cbacfb7 100644 --- a/transformer/mappings.py +++ b/transformer/mappings.py @@ -315,10 +315,6 @@ class SourcePackageToDigitalObject(odin.Mapping): def extract_id(self, uri): return uri.rstrip("/").split("/")[-1] - @odin.map_field(from_field="storage_uri", to_field="title") - def title(self, value): - return self.extract_id(value) - @odin.map_field(from_field="storage_uri", to_field="digital_object_id") def digital_object_id(self, value): return self.extract_id(value) diff --git a/transformer/routines.py b/transformer/routines.py index 2c72076..801c857 100644 --- a/transformer/routines.py +++ b/transformer/routines.py @@ -191,6 +191,10 @@ def transform_object(self, package): """Creates a digital object for each package.""" data = {"storage_uri": package.storage_uri, "use_statement": package.use_statement} transformed = self.get_transformed_object(data, SourcePackage, SourcePackageToDigitalObject) + transfer_component = self.aspace_client.retrieve(package.archivesspace_transfer) + transformed['title'] = transfer_component['title'] + if package.origin == 'digitization': + transformed['publish'] = True do_uri = self.aspace_client.create(transformed, "digital object").get("uri") self.update_archival_object(package, do_uri) diff --git a/transformer/tests.py b/transformer/tests.py index b735c30..fb2b8cd 100644 --- a/transformer/tests.py +++ b/transformer/tests.py @@ -151,6 +151,7 @@ def test_process_digital_objects(self, as_update_object, as_object, as_create_ob self.assertEqual(msg, "Digital object created.") self.assertEqual(len(obj_list), 1) self.assertEqual(as_create_object.call_count, 1) + self.assertEqual(as_object.call_count, 2) @patch("transformer.clients.ElectronBond.authorize_oauth") @patch("transformer.clients.ElectronBond.patch")