fixed 1771:MongoDBAdapter ILIKE and widget.autocomplete, thanks Francisco

This commit is contained in:
mdipierro
2013-11-16 03:32:36 -06:00
parent de7848ba21
commit e0329ce59a
2 changed files with 6 additions and 1 deletions

View File

@@ -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

View File

@@ -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/' % \