django_gravatar/helpers.py
def has_gravatar(email):
    """
    Returns True if the user has a gravatar, False if otherwise
    """
    # Request a 404 response if the gravatar does not exist
    url = get_gravatar_url(email, default=GRAVATAR_DEFAULT_IMAGE_404)

    # Verify an OK response was received
    try:
        request = Request(url)
        request.get_method = lambda: 'HEAD'
        return 200 == urlopen(request).code
    except (HTTPError, URLError):
        return False
def has_gravatar(email):
    # Request a 404 response if the gravatar does not exist
    url = get_gravatar_url(email, default=GRAVATAR_DEFAULT_IMAGE_404)

    # Verify an OK response was received
    try:
        request = Request(url)
        request.get_method = lambda: 'HEAD'
        return 200 == urlopen(request).code
    except (HTTPError, URLError):
        return False
def has_gravatar ( email ) : # Request a 404 response if the gravatar does not exist url = get_gravatar_url ( email , default = GRAVATAR_DEFAULT_IMAGE_404 ) # Verify an OK response was received try : request = Request ( url ) request . get_method = lambda : 'HEAD' return 200 == urlopen ( request ) . code except ( HTTPError , URLError ) : return False
Returns True if the user has a gravatar, False if otherwise
Returns True if the user has a gravatar False if otherwise