diff --git a/qubesmanager/firewall.py b/qubesmanager/firewall.py index a5d9d75..68b5cc0 100644 --- a/qubesmanager/firewall.py +++ b/qubesmanager/firewall.py @@ -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}(? def handle_exception(exc_type, exc_value, exc_traceback): - import os.path - import traceback - filename, line, dummy, dummy = traceback.extract_tb(exc_traceback).pop() filename = os.path.basename(filename) error = "%s: %s" % (exc_type.__name__, exc_value)