MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / validate

Method validate

suds/properties.py:63–92  ·  view source on GitHub ↗

Validate that the two properties may be linked. @param pA: Endpoint (A) to link. @type pA: L{Endpoint} @param pB: Endpoint (B) to link. @type pB: L{Endpoint} @return: self @rtype: L{Link}

(self, pA, pB)

Source from the content-addressed store, hash-verified

61 b.links.append(pA)
62
63 def validate(self, pA, pB):
64 """
65 Validate that the two properties may be linked.
66 @param pA: Endpoint (A) to link.
67 @type pA: L{Endpoint}
68 @param pB: Endpoint (B) to link.
69 @type pB: L{Endpoint}
70 @return: self
71 @rtype: L{Link}
72 """
73 if pA in pB.links or \
74 pB in pA.links:
75 raise Exception('Already linked')
76 dA = pA.domains()
77 dB = pB.domains()
78 for d in dA:
79 if d in dB:
80 raise Exception('Duplicate domain "%s" found' % d)
81 for d in dB:
82 if d in dA:
83 raise Exception('Duplicate domain "%s" found' % d)
84 kA = pA.keys()
85 kB = pB.keys()
86 for k in kA:
87 if k in kB:
88 raise Exception('Duplicate key %s found' % k)
89 for k in kB:
90 if k in kA:
91 raise Exception('Duplicate key %s found' % k)
92 return self
93
94 def teardown(self):
95 """

Callers 2

__init__Method · 0.95
__setMethod · 0.45

Calls 2

domainsMethod · 0.80
keysMethod · 0.45

Tested by

no test coverage detected