return define_ID(cscoxId=cscoxId,upload_folder=app.config['UPLOAD_FOLDER'], request=request)
def define_ID(cscoxId,upload_folder,request):
import re
status=SVN_OPERATION.status()
if(status==''):
if(SVN_OPERATION.update()): return "Operation UPDATE has errors"
if(re.match('\d{4,}',cscoxId)):
session['customer_dir']=define_dir(cscoxId,upload_folder)
session['cox_id']=cscoxId
else:
return "You have to input CSCOX_ID. Please repeat your action."
else:
# when our file is locked.
info=SVN_OPERATION.info()
return "File is locked. Please, try your attempt late.\n Information aboult lock :\n{0}".format(info)
if(not session['customer_dir'][1]):
return "Ypsss...The CSCOX_ID {0} already exists xlsx file --> {1} and somebody works with it right now...".format(cscoxId,session['customer_dir'][0])
return upload_file(session['customer_dir'][0],request,cscoxId)
def upload_file(upload_folder,request,cscoxId):
if request.method == 'POST':
session['comment'] = request.form['comment']
session['mail'] = request.form['your_mail']
file = request.files['file']
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file.save(os.path.join(upload_folder, filename))
SVN_OPERATION.lock(comment=comment1)
session['comment']="{0}\t{1}".format(comment1,session['comment'])
main_operation(customer_dir=session['customer_dir'][0],customer_file=os.path.join(upload_folder, filename),log_name=session['cox_id'],commitComent=session['comment'],mails=session['mail'])
return redirect(url_for('index'))
return '''
<!doctype html>
<title>Upload Customer Excel </title>
<h1 >Please, upload customer file </h1>
<form action="" method=post enctype=multipart/form-data>
<p><input type=file name=file>
<input type=email name=your_mail value="Please, input your emails">Your Email<Br> </p>
<p>Commentary<Br>
<textarea name=comment cols="40" rows="3"></textarea></p>
<p><input type=submit value="go-go-go !!!">
<input type="reset" value="Clear"></p>
</form>
'''
Проблема в том, что когда я загружаю файл и идёт его обработка, я больше не могу ничего загрузить ,а я хотел бы иметь возможность загружать файлы и далее(upload_file), чтобы обработка шла последовательно, в порядке очереди :)
Пытался прикрутить multiprocessing , но что-то не получилось.
Может есть у кого опыт ? поделитесь пожалуйста!
Заранее вас благодарю!