Add Importer.progress_loop() convenience method

This commit is contained in:
Lance Edgar 2016-12-14 22:04:46 -06:00
parent 6055b9e3e8
commit 874ba69813

View file

@ -31,6 +31,7 @@ import logging
from rattail.db import cache from rattail.db import cache
from rattail.db.util import QuerySequence from rattail.db.util import QuerySequence
from rattail.time import make_utc from rattail.time import make_utc
from rattail.util import progress_loop
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -121,6 +122,10 @@ class Importer(object):
Perform any cleanup after import, if necessary. Perform any cleanup after import, if necessary.
""" """
def progress_loop(self, func, items, factory=None, **kwargs):
factory = factory or self.progress
return progress_loop(func, items, factory, **kwargs)
def import_data(self, host_data=None, now=None, **kwargs): def import_data(self, host_data=None, now=None, **kwargs):
""" """
Import some data! This is the core body of logic for that, regardless Import some data! This is the core body of logic for that, regardless