Changeset - 8cebc88068ab
[Not reviewed]
0 1 0
Lance Edgar (lance) - 4 years ago 2020-08-12 15:10:33
lance@edbob.org
Fix how we obtain local system title for importers

we just can't go around assuming a handler is always in use
1 file changed with 11 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rattail/importing/importers.py
Show inline comments
 
@@ -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):
 
        """
0 comments (0 inline, 0 general)