def to_python(self,value):
       """Validate/convert value before setting the property.

       The value must be an integer and between self.min and
       self.max inclusive (if not None).
       """

       if (self.min is not None) and value < self.min:
           raise ValueError,"%s is less than %s" % (value,self.min)

       if (self.max is not None) and value > self.max:
           raise ValueError,"%s is greater than %s" % (value,self.max)

       return int(value)
Validate/convert value before setting the property.

       The value must be an integer and between self.min and
       self.max inclusive (if not None).
       
recipes/Python/569149_Properties_value_checking_optiuse_FormEncode/recipe-569149.py