From 1ffaacb3d2696d3bdea78104c26bbe82f394f67b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 11 Jul 2018 10:08:29 -0500 Subject: [PATCH] Add customization hook for datasync consumer when fetching local object --- rattail/datasync/consumers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rattail/datasync/consumers.py b/rattail/datasync/consumers.py index c0b7014a..747631db 100644 --- a/rattail/datasync/consumers.py +++ b/rattail/datasync/consumers.py @@ -182,7 +182,7 @@ class NewDataSyncImportConsumer(DataSyncConsumer): if host_data is None: return key = importer.get_key(host_data) - local_object = importer.get_local_object(key) + local_object = self.get_local_object(importer, key, host_data) if local_object: if importer.allow_update: local_data = importer.normalize_local_object(local_object) @@ -216,6 +216,12 @@ class NewDataSyncImportConsumer(DataSyncConsumer): """ raise NotImplementedError + def get_local_object(self, importer, key, host_data): + """ + Fetch the "local" (destination) object for the given key. + """ + return importer.get_local_object(key) + class NullTestConsumer(DataSyncConsumer): """