Skip to content

Commit

Permalink
fixes web2py#1493 (at @abastardi's bidding)
Browse files Browse the repository at this point in the history
  • Loading branch information
niphlod committed Oct 7, 2016
1 parent e6a3081 commit 555f2ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gluon/dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 555f2ad

Please sign in to comment.