|
@@ -34,15 +34,15 @@ class QIPAddressValidator(QtGui.QValidator):
|
|
|
def __init__(self, parent=None):
|
|
|
super(QIPAddressValidator, self).__init__(parent)
|
|
|
|
|
|
- def validate(self, input, pos):
|
|
|
+ def validate(self, input_string, pos):
|
|
|
# pylint: disable=too-many-return-statements,no-self-use
|
|
|
- hostname = str(input)
|
|
|
+ hostname = str(input_string)
|
|
|
|
|
|
if len(hostname) > 255 or len(hostname) == 0:
|
|
|
- return (QtGui.QValidator.Intermediate, input, pos)
|
|
|
+ return (QtGui.QValidator.Intermediate, input_string, pos)
|
|
|
|
|
|
if hostname == "*":
|
|
|
- return (QtGui.QValidator.Acceptable, input, pos)
|
|
|
+ return (QtGui.QValidator.Acceptable, input_string, pos)
|
|
|
|
|
|
unmask = hostname.split("/", 1)
|
|
|
if len(unmask) == 2:
|
|
@@ -50,25 +50,25 @@ class QIPAddressValidator(QtGui.QValidator):
|
|
|
mask = unmask[1]
|
|
|
if mask.isdigit() or mask == "":
|
|
|
if re.match(r"^([0-9]{1,3}\.){3}[0-9]{1,3}$", hostname) is None:
|
|
|
- return (QtGui.QValidator.Invalid, input, pos)
|
|
|
+ return (QtGui.QValidator.Invalid, input_string, pos)
|
|
|
if mask != "":
|
|
|
mask = int(unmask[1])
|
|
|
if mask < 0 or mask > 32:
|
|
|
- return (QtGui.QValidator.Invalid, input, pos)
|
|
|
+ return (QtGui.QValidator.Invalid, input_string, pos)
|
|
|
else:
|
|
|
- return (QtGui.QValidator.Invalid, input, pos)
|
|
|
+ return (QtGui.QValidator.Invalid, input_string, pos)
|
|
|
|
|
|
if hostname[-1:] == ".":
|
|
|
hostname = hostname[:-1]
|
|
|
|
|
|
if hostname[-1:] == "-":
|
|
|
- return (QtGui.QValidator.Intermediate, input, pos)
|
|
|
+ return (QtGui.QValidator.Intermediate, input_string, pos)
|
|
|
|
|
|
allowed = re.compile(r"(?!-)[A-Z\d-]{1,63}(?<!-)$", re.IGNORECASE)
|
|
|
if all(allowed.match(x) for x in hostname.split(".")):
|
|
|
- return (QtGui.QValidator.Acceptable, input, pos)
|
|
|
+ return (QtGui.QValidator.Acceptable, input_string, pos)
|
|
|
|
|
|
- return (QtGui.QValidator.Invalid, input, pos)
|
|
|
+ return (QtGui.QValidator.Invalid, input_string, pos)
|
|
|
|
|
|
class NewFwRuleDlg(QtGui.QDialog, ui_newfwruledlg.Ui_NewFwRuleDlg):
|
|
|
def __init__(self, parent=None):
|