def IntegerValidator(min, max):
    """
    Factory function, returns validator method processing integers.
    """
    def _validator(value):
        try:
            int(value)
            if value < min:
                raise forms.ValidationError(_("Minimum is %d" % min))
            elif value > max:
                raise forms.ValidationError(_("Maximum is %d" % max))
        except __HOLE__:
            raise forms.ValidationError(_("Must be a number"))
        return value
    return _validator
dataset/ETHPy150Open lukaszb/django-projector/projector/utils/validators.py/IntegerValidator