finally fix url validator
This commit is contained in:
parent
99a3e4c880
commit
f8f471e7ee
@ -14,7 +14,7 @@
|
|||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import six
|
from six.moves.urllib.parse import urlparse
|
||||||
|
|
||||||
def validate_email(email):
|
def validate_email(email):
|
||||||
"""
|
"""
|
||||||
@ -31,7 +31,7 @@ def validate_url(url):
|
|||||||
Returns True if valid and False if invalid
|
Returns True if valid and False if invalid
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
six.moves.urlparse(url)
|
urlparse(url)
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user