Changeset 8cebc88 in rattail


Ignore:
Timestamp:
08/12/2020 03:10:33 PM (2 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
785a54f
Parents:
87f11679
Message:

Fix how we obtain local system title for importers

we just can't go around assuming a handler is always in use

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/importing/importers.py

    r87f11679 r8cebc88  
    131131        self._setup(**kwargs)
    132132
     133    def get_local_system_title(self):
     134        """
     135        Retrieve the system title for the local/target side.
     136        """
     137        if hasattr(self, 'handler'):
     138            return self.handler.local_title
     139        return self.local_system_title or "??"
     140
    133141    def include_fields(self, *args):
    134142        """
     
    297305        try:
    298306            self.progress_loop(import_, data, message="{}ing {} data to {}".format(
    299                 self.direction.capitalize(), self.model_name, self.handler.local_title))
     307                self.direction.capitalize(), self.model_name, self.get_local_system_title()))
    300308        except ImportLimitReached:
    301309            pass
     
    470478        self.progress_loop(cache, objects,
    471479                           message="Reading {} data from {}".format(
    472                                self.model_name, self.handler.local_title))
     480                               self.model_name, self.get_local_system_title()))
    473481        return cached
    474482
     
    477485        Must return a message to be used for progress when fetching "local" data.
    478486        """
    479         return "Reading {} data from {}".format(self.model_name, self.handler.local_title)
     487        return "Reading {} data from {}".format(self.model_name, self.get_local_system_title())
    480488
    481489    def get_cache_key(self, obj, normal):
Note: See TracChangeset for help on using the changeset viewer.