diff --git a/rattail/batch/pricing.py b/rattail/batch/pricing.py index 3bd1c4171dd1afd1c9de5d526e990028b54f1c98..72ef8c0d77e3f7d53783b274fbba575450c72c36 100644 --- a/rattail/batch/pricing.py +++ b/rattail/batch/pricing.py @@ -48,11 +48,9 @@ class PricingBatchHandler(BatchHandler): def append(item, i): row = model.PricingBatchRow() - with session.no_autoflush: - row.product = item - row.upc = row.product.upc - batch.add_row(row) - self.refresh_row(row) + row.product = item + row.upc = row.product.upc + self.add_row(batch, row) assert self.progress_loop(append, batch.products, progress, message="Adding initial rows to batch") diff --git a/rattail/batch/vendorcatalog.py b/rattail/batch/vendorcatalog.py index bd835e8e90ee5a4426bf97a29622ddad1648245d..893441613d05f40623d1c5607471d3a15928e97a 100644 --- a/rattail/batch/vendorcatalog.py +++ b/rattail/batch/vendorcatalog.py @@ -1,4 +1,4 @@ -# -*- coding: utf-8 -*- +# -*- coding: utf-8; -*- ################################################################################ # # Rattail -- Retail Software Framework @@ -80,14 +80,13 @@ class VendorCatalogHandler(BatchHandler): self.setup_populate(batch, progress=progress) def append(row, i): - batch.add_row(row) - self.refresh_row(row) - if i % 250 == 0: + self.add_row(batch, row) + if i % 5000 == 0: session.flush() data = list(parser.parse_rows(path, progress=progress)) - assert self.progress_loop(append, data, progress, - message="Adding initial rows to batch") + self.progress_loop(append, data, progress, + message="Adding initial rows to batch") def identify_product(self, row): product = None