diff --git a/rattail/importing/importers.py b/rattail/importing/importers.py index d6a1b28bbc0d1487d34621abb5d772b8b56884df..0b5af604e47fe2e4c2030fdc9e89b499b1509a0d 100644 --- a/rattail/importing/importers.py +++ b/rattail/importing/importers.py @@ -130,6 +130,14 @@ class Importer(object): self.model_name = self.model_class.__name__ self._setup(**kwargs) + def get_local_system_title(self): + """ + Retrieve the system title for the local/target side. + """ + if hasattr(self, 'handler'): + return self.handler.local_title + return self.local_system_title or "??" + def include_fields(self, *args): """ Add the given fields to the supported field list for the importer. May @@ -296,7 +304,7 @@ class Importer(object): try: self.progress_loop(import_, data, message="{}ing {} data to {}".format( - self.direction.capitalize(), self.model_name, self.handler.local_title)) + self.direction.capitalize(), self.model_name, self.get_local_system_title())) except ImportLimitReached: pass self.flush_create_update_final() @@ -469,14 +477,14 @@ class Importer(object): self.progress_loop(cache, objects, message="Reading {} data from {}".format( - self.model_name, self.handler.local_title)) + self.model_name, self.get_local_system_title())) return cached def cache_local_message(self): """ Must return a message to be used for progress when fetching "local" data. """ - return "Reading {} data from {}".format(self.model_name, self.handler.local_title) + return "Reading {} data from {}".format(self.model_name, self.get_local_system_title()) def get_cache_key(self, obj, normal): """