urlutils: Clean up qurl_from_user_input in is_url.

This commit is contained in:
Florian Bruhin 2015-05-20 13:33:50 +02:00
parent 269676318b
commit ddb6743b26

View File

@ -236,6 +236,7 @@ def is_url(urlstr):
urlstr = urlstr.strip()
qurl = QUrl(urlstr)
qurl_userinput = qurl_from_user_input(urlstr)
if not autosearch:
# no autosearch, so everything is a URL unless it has an explicit
@ -246,6 +247,9 @@ def is_url(urlstr):
else:
return False
if not qurl_userinput.isValid():
return False
if _has_explicit_scheme(qurl):
# URLs with explicit schemes are always URLs
log.url.debug("Contains explicit scheme")
@ -269,7 +273,7 @@ def is_url(urlstr):
else:
raise ValueError("Invalid autosearch value")
log.url.debug("url = {}".format(url))
return url and qurl_from_user_input(urlstr).isValid()
return url and qurl_userinput.isValid()
def qurl_from_user_input(urlstr):