wrap batch execution with transaction.manager

This commit is contained in:
Lance Edgar 2012-04-10 14:31:42 -05:00
parent 81f6b57a63
commit b28631d421

View file

@ -29,6 +29,7 @@
import formalchemy import formalchemy
from sqlalchemy import and_, or_ from sqlalchemy import and_, or_
import transaction
from pyramid.httpexceptions import HTTPFound from pyramid.httpexceptions import HTTPFound
from pyramid.renderers import render from pyramid.renderers import render
from pyramid.response import Response from pyramid.response import Response
@ -801,6 +802,8 @@ def execute(context, request):
# print 'got a batch' # print 'got a batch'
uuid = request.matchdict['uuid'] uuid = request.matchdict['uuid']
with transaction.manager:
batch = Session.query(rattail.Batch).get(uuid) if uuid else None batch = Session.query(rattail.Batch).get(uuid) if uuid else None
if not batch: if not batch:
return home return home