def avatar_url_from_openid(openid, size=64, default='retro', dns=False):
    """
    Our own implementation since fas doesn't support this nicely yet.
    """

    if dns:
        # This makes an extra DNS SRV query, which can slow down our webapps.
        # It is necessary for libravatar federation, though.
        import libravatar
        return libravatar.libravatar_url(
            openid=openid,
            size=size,
            default=default,
        )
    else:
        params = _ordered_query_params([('s', size), ('d', default)])
        query = parse.urlencode(params)
        hash = sha256(openid.encode('utf-8')).hexdigest()
        return "https://seccdn.libravatar.org/avatar/%s?%s" % (hash, query)
def avatar_url_from_openid ( openid , size = 64 , default = 'retro' , dns = False ) : if dns : import libravatar return libravatar . libravatar_url ( openid = openid , size = size , default = default , ) else : params = _ordered_query_params ( [ ( 's' , size ) , ( 'd' , default ) ] ) query = parse . urlencode ( params ) hash = sha256 ( openid . encode ( 'utf-8' ) ) . hexdigest ( ) return "https://seccdn.libravatar.org/avatar/%s?%s" % ( hash , query )
Our own implementation since fas doesn't support this nicely yet.