From e0329ce59aea3cc9940182d2db4a98b1e10b345d Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sat, 16 Nov 2013 03:32:36 -0600 Subject: [PATCH] fixed 1771:MongoDBAdapter ILIKE and widget.autocomplete, thanks Francisco --- VERSION | 2 +- gluon/dal.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d563a509..478b2c89 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.7.4-stable+timestamp.2013.11.16.03.22.18 +Version 2.7.4-stable+timestamp.2013.11.16.03.31.47 diff --git a/gluon/dal.py b/gluon/dal.py index c8fafcdd..eb260254 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5985,6 +5985,11 @@ class MongoDBAdapter(NoSQLAdapter): return {self.expand(first): ('%s' % \ self.expand(second, 'string').replace('%','/'))} + def ILIKE(self, first, second): + val = second if isinstance(second,self.ObjectId) else { + '$regex': second.replace('%', ''), '$options': 'i'} + return {self.expand(first): val} + def STARTSWITH(self, first, second): #escaping regex operators? return {self.expand(first): ('/^%s/' % \