Removed reliance on global rattail.db.Session class.

This commit is contained in:
Lance Edgar 2013-12-18 21:13:03 -08:00
parent 18453c0113
commit 7638020aa0
2 changed files with 5 additions and 2 deletions

View file

@ -31,6 +31,7 @@ from pyramid.renderers import render_to_response
from webhelpers.html import tags from webhelpers.html import tags
import edbob
from edbob.pyramid.forms import PrettyDateTimeFieldRenderer from edbob.pyramid.forms import PrettyDateTimeFieldRenderer
from ...forms import EnumFieldRenderer from ...forms import EnumFieldRenderer
from ...grids.search import BooleanSearchFilter from ...grids.search import BooleanSearchFilter
@ -140,7 +141,8 @@ class BatchCrud(CrudView):
class ExecuteBatch(View): class ExecuteBatch(View):
def execute_batch(self, batch, progress): def execute_batch(self, batch, progress):
from rattail.db import Session from rattail.db import get_session_class
Session = get_session_class(edbob.config)
session = Session() session = Session()
batch = session.merge(batch) batch = session.merge(batch)

View file

@ -300,7 +300,8 @@ def print_labels(request):
class CreateProductsBatch(ProductsGrid): class CreateProductsBatch(ProductsGrid):
def make_batch(self, provider, progress): def make_batch(self, provider, progress):
from rattail.db import Session from rattail.db import get_session_class
Session = get_session_class(edbob.config)
session = Session() session = Session()
self._filter_config = self.filter_config() self._filter_config = self.filter_config()