fixed validation of nagtive integers, thanks Stefan

This commit is contained in:
mdipierro
2013-10-11 18:06:57 -05:00
parent 3635dd8faf
commit ff7f9568db
2 changed files with 4 additions and 2 deletions

View File

@@ -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

View File

@@ -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)):