python3 compliance

* This ones for you rydog
This commit is contained in:
chris meyers
2018-11-29 14:07:43 -05:00
parent d347a06e3d
commit 21fce00102

View File

@@ -9,6 +9,7 @@ import time
import socket import socket
import sys import sys
import requests import requests
import functools
from base64 import b64encode from base64 import b64encode
from collections import OrderedDict, Iterable from collections import OrderedDict, Iterable
import six import six
@@ -2963,8 +2964,8 @@ class WorkflowJobTemplateNodeChildrenBaseList(WorkflowsEnforcementMixin, Enforce
''' '''
relationships = ['success_nodes', 'failure_nodes', 'always_nodes'] relationships = ['success_nodes', 'failure_nodes', 'always_nodes']
relationships.remove(self.relationship) relationships.remove(self.relationship)
qs = reduce(lambda x, y: (x | y), qs = functools.reduce(lambda x, y: (x | y),
(Q(**{'{}__in'.format(rel): [sub.id]}) for rel in relationships)) (Q(**{'{}__in'.format(rel): [sub.id]}) for rel in relationships))
if WorkflowJobTemplateNode.objects.filter(Q(pk=parent.id) & qs).exists(): if WorkflowJobTemplateNode.objects.filter(Q(pk=parent.id) & qs).exists():
return {"Error": _("Relationship not allowed.")} return {"Error": _("Relationship not allowed.")}