fileadmin.py 文件源码

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

项目:autoimgsys 作者: rbogle 项目源码 文件源码
def download(self, path=None):
        """
            Download view method.

            :param path:
                File path.
        """
        if not self.can_download:
            abort(404)
        logger = logging.getLogger(self.__class__.__name__)  
        base_path, directory, path = self._normalize_path(path)

        # backward compatibility with base_url
        base_url = self.get_base_url()
        if base_url:
            base_url = urljoin(self.get_url('.index'), base_url)
            return redirect(urljoin(base_url, path))
        if op.isdir(directory):
            logger.debug("Directory download asked for: %s" %path)
            shutil.make_archive(directory,'zip',directory)
            return redirect(self._get_dir_url('.index', op.dirname(path)))
        return send_file(directory)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号