server.py 文件源码

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

项目:django-gateone 作者: jimmy201602 项目源码 文件源码
def validate_absolute_path(self, root, absolute_path):
        """
        An override of
        :meth:`tornado.web.StaticFileHandler.validate_absolute_path`;

        Validate and returns the given *absolute_path* using `pkg_resources`
        if ``self.use_pkg`` is set otherwise performs a normal filesystem
        validation.
        """
        # We have to generate the real absolute path in this method since the
        # Tornado devs--for whatever reason--decided that get_absolute_path()
        # must be a classmethod (we need access to self.use_pkg).
        if self.use_pkg:
            if not resource_exists(self.use_pkg, absolute_path):
                raise HTTPError(404)
            return resource_filename(self.use_pkg, absolute_path)
        return super(
            StaticHandler, self).validate_absolute_path(root, absolute_path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号