tools.py 文件源码

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

项目:touch-pay-client 作者: HackPucBemobi 项目源码 文件源码
def select_host(self, host, host_names=None):
        """
        checks that host is valid, i.e. in the list of glob host_names
        if the host is missing, then is it selects the first entry from host_names
        read more here: https://github.com/web2py/web2py/issues/1196
        """
        if host:
            if host_names:
                for item in host_names:
                    if fnmatch.fnmatch(host, item):
                        break
                else:
                    raise HTTP(403, "Invalid Hostname")
        elif host_names:
            host = host_names[0]
        else:
            host = 'localhost'
        return host
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号