From 555f2ad0405abf54356941039aac3fcffdf7f5b5 Mon Sep 17 00:00:00 2001 From: niphlod Date: Fri, 7 Oct 2016 21:20:10 +0200 Subject: [PATCH] fixes #1493 (at @abastardi's bidding) --- gluon/dal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index d73720cf..95476a9f 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