From 5d9fc2e9af0d4317e06a6cf008b7e2293c934838 Mon Sep 17 00:00:00 2001 From: Massimo Date: Thu, 21 Feb 2013 10:21:31 -0600 Subject: [PATCH] fixed issue VirtualFields in select options --- VERSION | 2 +- gluon/validators.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 9061d438..c82acc19 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.4.1-alpha.2+timestamp.2013.02.21.10.15.58 +Version 2.4.1-alpha.2+timestamp.2013.02.21.10.20.58 diff --git a/gluon/validators.py b/gluon/validators.py index 1d3151b0..75fef15c 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -20,6 +20,7 @@ import decimal import unicodedata from cStringIO import StringIO from utils import simple_hash, web2py_uuid, DIGEST_ALG_BY_SIZE +from dal import FieldVirtual, FieldMethod JSONErrors = (NameError, TypeError, ValueError, AttributeError, KeyError) @@ -507,7 +508,9 @@ class IS_IN_DB(Validator): if self.fields == 'all': fields = [f for f in table] else: - fields = [table[k] for k in self.fields] + fields = [table[k] for k in self.fields] + ignore = (FieldVirtual,FieldMethod) + fields = filter(lambda f:not isinstance(f,ignore), fields) if self.dbset.db._dbname != 'gae': orderby = self.orderby or reduce(lambda a, b: a | b, fields) groupby = self.groupby