fixed validation of nagtive integers, thanks Stefan
This commit is contained in:
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.7.2-stable+timestamp.2013.10.11.17.58.33
|
||||
Version 2.7.2-stable+timestamp.2013.10.11.18.05.57
|
||||
|
||||
@@ -22,6 +22,8 @@ from cStringIO import StringIO
|
||||
from gluon.utils import simple_hash, web2py_uuid, DIGEST_ALG_BY_SIZE
|
||||
from gluon.dal import FieldVirtual, FieldMethod
|
||||
|
||||
regex_isint = re.compile('^\-?\d+$')
|
||||
|
||||
JSONErrors = (NameError, TypeError, ValueError, AttributeError,
|
||||
KeyError)
|
||||
try:
|
||||
@@ -741,7 +743,7 @@ class IS_INT_IN_RANGE(Validator):
|
||||
% dict(min=self.minimum, max=self.maximum - 1)
|
||||
|
||||
def __call__(self, value):
|
||||
if value and str(value).isdigit():
|
||||
if value 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)):
|
||||
|
||||
Reference in New Issue
Block a user