From 359d6c957992eac42f8f0d500d4df9811304f40f Mon Sep 17 00:00:00 2001 From: mdipierro Date: Mon, 10 Sep 2012 07:51:45 -0500 Subject: [PATCH] fixed issue 989, thanks Dominic --- VERSION | 2 +- gluon/dal.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 85ace5fc..c910c778 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.0.8 (2012-09-10 07:47:49) stable +Version 2.0.8 (2012-09-10 07:51:42) stable diff --git a/gluon/dal.py b/gluon/dal.py index 00e4e91e..20e8eb8c 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -8197,7 +8197,10 @@ class Expression(object): db = self.db if isinstance(value,(list, tuple)): subqueries = [self.contains(str(v).strip()) for v in value if str(v).strip()] - return reduce(all and AND or OR, subqueries,self.contains('')) + if not subqueries: + return self.contains('') + else: + return reduce(all and AND or OR,subqueries) if not self.type in ('string', 'text') and not self.type.startswith('list:'): raise SyntaxError, "contains used with incompatible field type" return Query(db, db._adapter.CONTAINS, self, value)