Fallback to default handler when no config available

e.g. when showing help for the command
This commit is contained in:
Lance Edgar 2020-02-27 21:52:50 -06:00
parent fa1e0c93e2
commit 2b8478ef0b

View file

@ -46,8 +46,11 @@ class ImportCOREPOS(commands.ImportSubcommand):
"Defaults to 'default'.")
def get_handler_factory(self, **kwargs):
if self.config:
spec = self.config.get('rattail.importing', 'corepos.handler',
default='rattail_corepos.importing.corepos:FromCOREPOSToRattail')
else:
spec = 'rattail_corepos.importing.corepos:FromCOREPOSToRattail'
return load_object(spec)
def get_handler_kwargs(self, **kwargs):