From 42c36bd295e96828a68a2936849b1bb9241fcbea Mon Sep 17 00:00:00 2001 From: mdipierro Date: Wed, 3 Jul 2013 04:00:32 -0500 Subject: [PATCH] fixed Issue 1572:mongodb contains operator typo, thanks Alan --- VERSION | 2 +- gluon/dal.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index bc3990c0..6fabaeea 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.6.0-development+timestamp.2013.07.03.01.52.44 +Version 2.6.0-development+timestamp.2013.07.03.03.59.49 diff --git a/gluon/dal.py b/gluon/dal.py index 22db9a76..33a72f3f 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -5718,7 +5718,7 @@ class MongoDBAdapter(NoSQLAdapter): # There is a technical difference, but mongodb doesn't support # that, but the result will be the same val = second if isinstance(second,self.ObjectId) else \ - {' $regex':".*" + re.escape(self.expand(second, 'string')) + ".*"} + {'$regex':".*" + re.escape(self.expand(second, 'string')) + ".*"} return {self.expand(first) : val} def LIKE(self, first, second): @@ -5751,7 +5751,7 @@ class MongoDBAdapter(NoSQLAdapter): #There is a technical difference, but mongodb doesn't support # that, but the result will be the same #TODO contains operators need to be transformed to Regex - return {self.expand(first) : {' $regex': \ + return {self.expand(first) : {'$regex': \ ".*" + re.escape(self.expand(second, 'string')) + ".*"}}