analyses.py 文件源码

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

项目:fame 作者: certsocietegenerale 项目源码 文件源码
def _save_analysis_file(self, id, path):
        file = request.files['file']
        analysis = Analysis(get_or_404(current_user.analyses, _id=id))
        dirpath = os.path.join(path, str(analysis['_id']))
        filepath = os.path.join(dirpath, secure_filename(file.filename))

        # Create parent dirs if they don't exist
        try:
            os.makedirs(dirpath)
        except:
            pass

        with open(filepath, "wb") as fd:
            copyfileobj(file.stream, fd)

        return filepath
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号