Fix how we obtain local system title for importers
we just can't go around assuming a handler is always in use
This commit is contained in:
parent
87f11679b9
commit
8cebc88068
|
@ -130,6 +130,14 @@ class Importer(object):
|
||||||
self.model_name = self.model_class.__name__
|
self.model_name = self.model_class.__name__
|
||||||
self._setup(**kwargs)
|
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):
|
def include_fields(self, *args):
|
||||||
"""
|
"""
|
||||||
Add the given fields to the supported field list for the importer. May
|
Add the given fields to the supported field list for the importer. May
|
||||||
|
@ -296,7 +304,7 @@ class Importer(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.progress_loop(import_, data, message="{}ing {} data to {}".format(
|
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:
|
except ImportLimitReached:
|
||||||
pass
|
pass
|
||||||
self.flush_create_update_final()
|
self.flush_create_update_final()
|
||||||
|
@ -469,14 +477,14 @@ class Importer(object):
|
||||||
|
|
||||||
self.progress_loop(cache, objects,
|
self.progress_loop(cache, objects,
|
||||||
message="Reading {} data from {}".format(
|
message="Reading {} data from {}".format(
|
||||||
self.model_name, self.handler.local_title))
|
self.model_name, self.get_local_system_title()))
|
||||||
return cached
|
return cached
|
||||||
|
|
||||||
def cache_local_message(self):
|
def cache_local_message(self):
|
||||||
"""
|
"""
|
||||||
Must return a message to be used for progress when fetching "local" data.
|
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):
|
def get_cache_key(self, obj, normal):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue