In request.values.get('param', 0) function if the param value is None, it returns the default value i.e 0 here. What if we could also apply a check that if param value doesn't lie in a specified range, in that case also it may return the default one.
Something like this
request.values.get('param', 0, ValueAtLeast(0))
So in above if the param value is -1, then also function should return the value 0.