|
@@ -115,9 +115,9 @@ class MongoDbDatasource(AbstractDatasource):
|
115
|
115
|
#Here we may implement the group
|
116
|
116
|
#If sorted query we have to sort again
|
117
|
117
|
if order is not None:
|
118
|
|
- results = sorted(results,
|
119
|
|
- key=functools.cmp_to_key(
|
120
|
|
- self.__generate_lambda_cmp_order(order)))
|
|
118
|
+ key_fun = functools.cmp_to_key(
|
|
119
|
+ self.__generate_lambda_cmp_order(order))
|
|
120
|
+ results = sorted(results, key=key_fun)
|
121
|
121
|
#If limit given apply limit again
|
122
|
122
|
if offset > len(results):
|
123
|
123
|
results = list()
|
|
@@ -851,7 +851,7 @@ field/operator couple in a query. We will keep only the first one")
|
851
|
851
|
glco = cls.__generate_lambda_cmp_order
|
852
|
852
|
fname, cmpdir = order[0]
|
853
|
853
|
order = order[1:]
|
854
|
|
- return lambda a,b: glco(order) if a[fname] == b[fname] else (\
|
|
854
|
+ return lambda a,b: glco(order)(a,b) if a[fname] == b[fname] else (\
|
855
|
855
|
1 if (a[fname]>b[fname] if cmpdir == 'ASC' else a[fname]<b[fname])\
|
856
|
856
|
else -1)
|
857
|
857
|
|