Wtforms: Integerfield Skips Coercion When String Value Is '0'
This question almost covers what I am after here, but not quite. It seems like IntegerField skips coercion when the string value is '0'. Any other positive integer seems to work ok
Solution 1:
I'm afraid you'd have to keep that type agnostic and use InputRequired instead :-)
The docs from here says:
"[...]this validator used to be called Required but the way it behaved (requiring coerced data, not input data) meant it functioned in a way which was not symmetric to the Optional validator and furthermore caused confusion with certain fields which coerced data to 'falsey' values like 0, Decimal(0), time(0) etc. Unless a very specific reason exists, we recommend using the :class:InputRequired instead."
The actual code cuplrit is a little down below at line 201:
if not field.data
Post a Comment for "Wtforms: Integerfield Skips Coercion When String Value Is '0'"