From bdbc053285b67fd3ee02f2ea862b30ca495f33e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonel=20C=C3=A2mara?= Date: Thu, 14 Apr 2016 03:57:20 +0100 Subject: [PATCH 1/2] fixes #1274 --- gluon/dal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/dal.py b/gluon/dal.py index 1c2a76fe..baeb624f 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -79,7 +79,7 @@ def _default_validators(db, field): if (field.notnull or field.unique) and not field_type 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]) + requires[0] = validators.IS_EMPTY_OR(requires[0], null='' if field in ('string', 'text', 'password') else None) return requires from gluon.serializers import custom_json, xml From 59cbe99347b141453d94a0afba5afad1b807e79c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonel=20C=C3=A2mara?= Date: Thu, 14 Apr 2016 04:13:18 +0100 Subject: [PATCH 2/2] pep8 and force travis to rebuild --- gluon/dal.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gluon/dal.py b/gluon/dal.py index baeb624f..b1414515 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -74,10 +74,10 @@ def _default_validators(db, field): return requires # does not get here for reference and list:reference if field.unique: - requires.insert(0,validators.IS_NOT_IN_DB(db, field)) - excluded_fields = ['string','upload','text','password','boolean'] + 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: - requires.insert(0,validators.IS_NOT_EMPTY()) + 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) return requires @@ -93,7 +93,7 @@ DAL.uuid = lambda x: web2py_uuid() DAL.representers = { 'rows_render': sqlhtml.represent, 'rows_xml': sqlhtml.SQLTABLE - } +} DAL.Field = Field DAL.Table = Table