utils.py 文件源码

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

项目:tucluster 作者: JamesRamm 项目源码 文件源码
def save_zip(self, stream, content_type, name=None):
        '''Save the zip stream to disk and extract its contents
        '''
        # Make sure the storage path exists
        ensure_dir(self._storage_path)

        ext = mimetypes.guess_extension(content_type)
        if not name:
            name = str(self._uuidgen())
        fname = '{uuid}{ext}'.format(uuid=name, ext=ext)
        archive_path = os.path.join(self._storage_path, fname)

        self._write(archive_path, stream)
        # extract the zip file
        directory = extract_model(archive_path, name, self._storage_path)
        return fmdb.id_from_path(directory), name
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号