From ca85afeb2f00a7d0de389f3a831503de824fdf53 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 1 Sep 2013 13:12:30 -0500 Subject: [PATCH] fixed issue 1342:MySQL, self-reference, and null values --- VERSION | 2 +- gluon/dal.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index c14ef9ff..df3ca77e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.09.01.12.42.52 +Version 2.6.0-development+timestamp.2013.09.01.13.11.38 diff --git a/gluon/dal.py b/gluon/dal.py index 44ee1d61..4c841800 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -6943,9 +6943,11 @@ def sqlhtml_validators(field): referenced._format,multiple=True) else: requires = validators.IS_IN_DB(db,referenced._id, - multiple=True) + multiple=True) if field.unique: requires._and = validators.IS_NOT_IN_DB(db,field) + if not field.notnull: + requires = validators.IS_EMPTY_OR(requires) return requires elif field_type.startswith('list:'): def repr_list(values,row=None): return', '.join(str(v) for v in (values or []))