def validate_result(current, default, type):
"""
Validates the data, whether it needs to be url, twitter, linkedin link etc.
"""
if current is None:
current = ""
if default is None:
default = ""
if type == "URL" and validators.url(current, require_tld=True) and not validators.url(default, require_tld=True):
return current
if type == "EMAIL" and validators.email(current) and not validators.email(default):
return current
return default
评论列表
文章目录