def validateField(self, validate, v): if v is None: return if 'range' in validate: r = validate['range'] if v < r[0] or v > r[1]: raise ValidationException('range', v, r, 'between') if 'value' in validate: if v != validate['value']: raise ValidationException('value', v, validate['value'], '=') if 'list' in validate: if v not in validate['list']: raise ValidationException('list', v, validate['list'], 'in') if 'min' in validate: if v < validate['min']: raise ValidationException('min', v, validate['min'], '>=')
def validateBin(v): if v not in [0, 1]: raise ValidationException('bin', v, [0, 1], 'in')
def validateYear(v): if v < 1: raise ValidationException('year', v, [1], '>')
def validateMonth(v): if v < 1 or v > 12: raise ValidationException('month', v, [1, 12], 'between')
def validateWeekday(v): if v < 1 or v > 7: raise ValidationException('weeak day', v, [1, 7], 'between')
def validateDay(v): if v < 1 or v > 31: raise ValidationException('day', v, [1, 31], 'between')
def validateHour(v): if v < 0 or v > 24: raise ValidationException('hour', v, [0, 24], 'between')