From ec3ae8211f365cf10ea1fff6b71ffee041231b7e Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sat, 19 Mar 2016 13:39:27 -0500 Subject: [PATCH] possibly fixed #1162, validation of required notnull fields, hope this does not break something else --- gluon/dal.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index f8579a70..9d18eb11 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -74,10 +74,10 @@ def _default_validators(db, field): return requires if field.unique: requires.append(validators.IS_NOT_IN_DB(db, field)) - sff = ['in', 'do', 'da', 'ti', 'de', 'bo'] - if field.notnull and not field_type[:2] in sff: - requires.append(validators.IS_NOT_EMPTY()) - elif not field.notnull and field_type[:2] in sff and requires: + + if field.notnull or field.unique: + requires.insert(0,validators.IS_NOT_EMPTY()) + elif not field.notnull and requires: requires[0] = validators.IS_EMPTY_OR(requires[0]) return requires