You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a schema with an IPAddress validator. The IP address is optional so the validation cannot raise errors when the ip field is missing. However, options that are supposed to allow fields to accept empty values do not work with this validator type.
Schema:
class IPTest(formencode.Schema):
ip = validators.IPAddress(not_empty=False, if_missing=None, if_invalid_python=None)
Action:
IPTest().to_python({"ip": "asdf"})
Expected Result: {"ip": None}
Actual Result:
>>> IPTest().to_python({"ip": "asdf"})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/formencode/api.py", line 476, in to_python
value = tp(value, state)
File "/usr/local/lib/python3.4/dist-packages/formencode/schema.py", line 217, in _convert_to_python
value_dict, state, error_dict=errors)
formencode.api.Invalid: ip: Please enter a valid IP address (a.b.c.d)
The text was updated successfully, but these errors were encountered:
I have a schema with an IPAddress validator. The IP address is optional so the validation cannot raise errors when the ip field is missing. However, options that are supposed to allow fields to accept empty values do not work with this validator type.
Schema:
Action:
Expected Result:
{"ip": None}
Actual Result:
The text was updated successfully, but these errors were encountered: