diff --git a/gluon/dal.py b/gluon/dal.py index d73720cf2..95476a9f2 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -75,10 +75,10 @@ def _default_validators(db, field): if field.unique: requires.insert(0, validators.IS_NOT_IN_DB(db, field)) excluded_fields = ['string', 'upload', 'text', 'password', 'boolean'] - if (field.notnull or field.unique) and not field_type in excluded_fields: + if (field.notnull or field.unique) and field_type not in excluded_fields: requires.insert(0, validators.IS_NOT_EMPTY()) elif not field.notnull and not field.unique and requires: - requires[0] = validators.IS_EMPTY_OR(requires[0], null='' if field in ('string', 'text', 'password') else None) + requires[0] = validators.IS_EMPTY_OR(requires[0], null='' if field.type in ('string', 'text', 'password') else None) return requires from gluon.serializers import custom_json, xml