From 667069b573ea74f3754d91bfe73c1078bd865df9 Mon Sep 17 00:00:00 2001 From: Stefan Pochmann Date: Sat, 12 Oct 2013 21:10:29 +0200 Subject: [PATCH] Corrections for IS_INT_IN_RANGE --- gluon/dal.py | 6 ++++-- gluon/validators.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index 2d8a2e42..286077a6 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6925,8 +6925,10 @@ def sqlhtml_validators(field): requires.append(validators.IS_EMPTY_OR(validators.IS_JSON(native_json=field.db._adapter.native_json))) elif field_type == 'double' or field_type == 'float': requires.append(validators.IS_FLOAT_IN_RANGE(-1e100, 1e100)) - elif field_type in ('integer','bigint'): - requires.append(validators.IS_INT_IN_RANGE(-2**31, 2**31-1)) + elif field_type == 'integer': + requires.append(validators.IS_INT_IN_RANGE(-2**31, 2**31)) + elif field_type == 'bigint': + requires.append(validators.IS_INT_IN_RANGE(-2**63, 2**63)) elif field_type.startswith('decimal'): requires.append(validators.IS_DECIMAL_IN_RANGE(-10**10, 10**10)) elif field_type == 'date': diff --git a/gluon/validators.py b/gluon/validators.py index 76d9dc0c..816a0656 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -743,7 +743,7 @@ class IS_INT_IN_RANGE(Validator): % dict(min=self.minimum, max=self.maximum - 1) def __call__(self, value): - if value and regex_isint.match(str(value)): + if value is not None and regex_isint.match(str(value)): v = int(value) if ((self.minimum is None or v >= self.minimum) and (self.maximum is None or v < self.maximum)):