diff --git a/demo/settings.yaml b/demo/settings.yaml index 0ed2898..c83441c 100644 --- a/demo/settings.yaml +++ b/demo/settings.yaml @@ -65,4 +65,4 @@ delay: # proxy: # protocol: https # NOTE: you can also set to 'http' # ip: "1.1.1.1" -# port: '200' \ No newline at end of file +# port: 200 \ No newline at end of file diff --git a/demo/settings_USA.yaml b/demo/settings_USA.yaml index 12c6903..325272e 100644 --- a/demo/settings_USA.yaml +++ b/demo/settings_USA.yaml @@ -67,4 +67,4 @@ delay: # proxy: # protocol: https # NOTE: you can also set to 'http' # ip: "1.1.1.1" -# port: '200' \ No newline at end of file +# port: 200 \ No newline at end of file diff --git a/jobfunnel/config/settings.py b/jobfunnel/config/settings.py index 5b84d4f..e8650f4 100644 --- a/jobfunnel/config/settings.py +++ b/jobfunnel/config/settings.py @@ -152,7 +152,7 @@ class JobFunnelSettingsValidator(Validator): """A simple JSON data validator with a custom data type for IPv4 addresses https://codingnetworker.com/2016/03/validate-json-data-using-cerberus/ """ - def _validate_type_ipv4address(self, field, value): + def _validate_type_ipv4address(self, value): """ checks that the given value is a valid IPv4 address """ @@ -160,8 +160,9 @@ def _validate_type_ipv4address(self, field, value): # try to create an IPv4 address object using the python3 ipaddress # module ipaddress.IPv4Address(value) + return True except: - self._error(field, "Not a valid IPv4 address") + self._error(value, "Not a valid IPv4 address") SettingsValidator = JobFunnelSettingsValidator(SETTINGS_YAML_SCHEMA)