Add explicit session config within batch threads.

This may not be particularly necessary in general, but this change is
required to match previous functionality.
This commit is contained in:
Lance Edgar 2014-11-02 19:40:14 -06:00
parent 8faec95b17
commit 4a598bd360
2 changed files with 4 additions and 0 deletions

View file

@ -39,6 +39,7 @@ from ...progress import SessionProgress
from rattail import enum
from rattail import batches
from rattail.db.util import configure_session
from ...db import Session
from rattail.db.model import Batch
from rattail.threads import Thread
@ -142,6 +143,7 @@ class ExecuteBatch(View):
def execute_batch(self, batch, progress):
from rattail.db import Session
session = Session()
configure_session(session)
batch = session.merge(batch)
if not batch.execute(progress):

View file

@ -51,6 +51,7 @@ from rattail.db.model import (
Brand, Vendor, Department, Subdepartment, LabelProfile)
from rattail.gpc import GPC
from rattail.db.api import get_product_by_upc
from rattail.db.util import configure_session
from rattail.pod import get_image_url, get_image_path
from ..db import Session
@ -344,6 +345,7 @@ class CreateProductsBatch(ProductsGrid):
def make_batch(self, provider, progress):
from rattail.db import Session
session = Session()
configure_session(session)
self._filter_config = self.filter_config()
self._sort_config = self.sort_config()