discussion.py 文件源码

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

项目:idealoom 作者: conversence 项目源码 文件源码
def check_url_or_none(self, url):
        if url == '':
            url = None
        if url is not None:
            from urllib.parse import urlparse
            parsed_url = urlparse(url)
            from pyramid.httpexceptions import HTTPBadRequest
            if not parsed_url.scheme:
                raise HTTPBadRequest(
                    "The homepage url does not have a scheme. Must be either http or https"
                )

            if parsed_url.scheme not in (u'http', u'https'):
                raise HTTPBadRequest(
                    "The url has an incorrect scheme. Only http and https are accepted for homepage url"
                )
        return url
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号