Fixed critical error in Fingerprint where upload was not committed.

This commit is contained in:
Tanshu 2013-02-26 19:17:51 +05:30
parent 5ff11d9c6b
commit 399d0c88f2
1 changed files with 4 additions and 0 deletions

View File

@ -2,18 +2,22 @@ import csv
import datetime
from io import StringIO
from pyramid.view import view_config
import transaction
from brewman.models import DBSession
from brewman.models.validation_exception import TryCatchFunction
from brewman.models.voucher import Fingerprint
__author__ = 'tanshu'
@view_config(request_method='POST', route_name='api_fingerprint', renderer='json', permission='Authenticated')
@TryCatchFunction
def show_list(request):
filename = request.POST['uploadedFile'].filename
input_file = request.POST['uploadedFile'].file
reader = csv.reader(read_file(input_file), delimiter=";")
for row in reader:
add_fingerprint(row)
transaction.commit()
return filename