Module: check_mk
Branch: master
Commit: 0673964246d115ff54687e3d2af48e7054fcc9db
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0673964246d115…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 4 07:44:07 2019 +0100
Make Url() valuespecs handle allow_empty=True correctly
Change-Id: If16f38f1d1c871537fdb9e8ba4c9afadaa63b459
---
cmk/gui/valuespec.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmk/gui/valuespec.py b/cmk/gui/valuespec.py
index 582eac4..69781d8 100644
--- a/cmk/gui/valuespec.py
+++ b/cmk/gui/valuespec.py
@@ -917,6 +917,10 @@ class Url(TextAscii):
def validate_value(self, value, varprefix):
super(Url, self).validate_value(value, varprefix)
+ if self._allow_empty and value == "":
+ ValueSpec.custom_validate(self, value, varprefix)
+ return
+
parts = urlparse.urlparse(value)
if not parts.scheme or not parts.netloc:
raise MKUserError(varprefix, _("Invalid URL given"))