conftype: Simplify URL checking for Proxy.
This commit is contained in:
parent
6011cc80ae
commit
a81bd44850
@ -972,16 +972,7 @@ class Proxy(BaseType):
|
|||||||
if not url.isValid():
|
if not url.isValid():
|
||||||
raise ValidationError(value, "invalid url, {}".format(
|
raise ValidationError(value, "invalid url, {}".format(
|
||||||
url.errorString()))
|
url.errorString()))
|
||||||
elif (url.isValid() and not url.isEmpty() and
|
elif url.scheme() not in self.PROXY_TYPES:
|
||||||
url.scheme() in self.PROXY_TYPES):
|
|
||||||
if url.userName() and url.password():
|
|
||||||
pass
|
|
||||||
elif not url.userName() and not url.password():
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
raise ValidationError(value, "must either have user and "
|
|
||||||
"password or none of both")
|
|
||||||
else:
|
|
||||||
raise ValidationError(value, "must be a proxy URL (http://... or "
|
raise ValidationError(value, "must be a proxy URL (http://... or "
|
||||||
"socks://...) or system/none!")
|
"socks://...) or system/none!")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user