Example
validation schema:
class ValidToken(formencode.FancyValidator):
def _to_python(self, value, state):
if value == None
raise formencode.Invalid(
"Must have a value", value, state)
return value
controller:
# controller method
input_val = None
try:
val = ValidToken.to_python(input_val)
except formencode.Invalid, e:
return "Failed due to invalid value"
return "OK"
The expected output: Failed due to invalid value
Actual output: OK