utils.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:MegaQC 作者: ewels 项目源码 文件源码
def store_report_data(user, report_data, uploaded_file):
    file_name = ''.join([random.choice(string.lowercase) for i in xrange(10)])
    if report_data:
        with open(os.path.join(current_app.config['UPLOAD_FOLDER'], file_name),"w") as fh:
            fh.write(report_data)
    else:
        uploaded_file.save(os.path.join(current_app.config['UPLOAD_FOLDER'], file_name))

    upload_row = Upload(
                        upload_id=Upload.get_next_id(),
                        status="NOT TREATED",
                        path=os.path.join(current_app.config['UPLOAD_FOLDER'], file_name),
                        message="File has been created, loading in MegaQC is queued.",
                        user_id=user.user_id
                )
    upload_row.save()
    return (True, 'Data upload queued successfully')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号