@staticmethod
    def extract_url_from_field(obj, field_name):
        val = getattr(obj, field_name)
        try:
            try:
                url = val.url  # FileField and ImageField have a url property
            except __HOLE__:  # And it throws an exception for empty fields
                url = ''
        except AttributeError:
            url = val  # Assume the field returns the url directly
        
        return url or ''  # Coerce None to ''
dataset/ETHPy150Open DjangoAdminHackers/django-linkcheck/linkcheck/__init__.py/Linklist.extract_url_from_field