conftype: Simplify URL checking for Proxy.

This commit is contained in:
Florian Bruhin 2014-08-05 21:06:11 +02:00
parent 6011cc80ae
commit a81bd44850

View File

@ -972,16 +972,7 @@ class Proxy(BaseType):
if not url.isValid():
raise ValidationError(value, "invalid url, {}".format(
url.errorString()))
elif (url.isValid() and not url.isEmpty() and
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:
elif url.scheme() not in self.PROXY_TYPES:
raise ValidationError(value, "must be a proxy URL (http://... or "
"socks://...) or system/none!")