aboutsummaryrefslogtreecommitdiff
path: root/saleor/graphql
diff options
context:
space:
mode:
authorMarcin Gębala <maarcin.gebala@gmail.com>2017-01-03 13:55:00 +0100
committerMarcin Gębala <maarcin.gebala@gmail.com>2017-01-04 11:22:36 +0100
commitca53db20c50fce952ca3a8dc1ff0e3b4fd6cc476 (patch)
tree726453a718a088fcd2a2fc4e88706c05965c60b1 /saleor/graphql
parentc432c9a4e069c894d57040767609d433c8b770c9 (diff)
downloadsaleor-frontend-ca53db20c50fce952ca3a8dc1ff0e3b4fd6cc476.tar.gz
saleor-frontend-ca53db20c50fce952ca3a8dc1ff0e3b4fd6cc476.tar.bz2
saleor-frontend-ca53db20c50fce952ca3a8dc1ff0e3b4fd6cc476.zip
Use reduce from functools
Diffstat (limited to 'saleor/graphql')
-rw-r--r--saleor/graphql/api.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.py
index 0b0b3d8f..626cbee8 100644
--- a/saleor/graphql/api.py
+++ b/saleor/graphql/api.py
@@ -1,3 +1,4 @@
+import functools
import graphene
import operator
@@ -132,11 +133,11 @@ class CategoryType(DjangoObjectType):
if queries:
# Combine filters of the same attribute with OR operator
# and then combine full query with AND operator.
- combine_and = [reduce(operator.or_, [
+ combine_and = [functools.reduce(operator.or_, [
Q(**{'variants__attributes__%s' % key: v}) |
Q(**{'attributes__%s' % key: v})
for v in values]) for key, values in queries.items()]
- query = reduce(operator.and_, combine_and)
+ query = functools.reduce(operator.and_, combine_and)
qs = qs.filter(query).distinct()
if order_by: