Skip to content

Commit

Permalink
refacter get_fault logic
Browse files Browse the repository at this point in the history
  • Loading branch information
eshizhan committed Apr 26, 2024
1 parent 4c93ed9 commit ddf097c
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions suds/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -869,17 +869,12 @@ def __get_fault(self, replyroot):
@rtype: L{Object}
"""
envns = suds.bindings.binding.envns
envns12 = suds.bindings.binding.envns12
soapenv = replyroot and replyroot.getChild("Envelope", envns)
if not soapenv:
soapenv = replyroot and replyroot.getChild("Envelope", envns12)
soapbody = soapenv and soapenv.getChild("Body", envns)
if not soapbody:
soapbody = soapenv and soapenv.getChild("Body", envns12)
fault = soapbody and soapbody.getChild("Fault", envns)
if not fault:
fault = soapbody and soapbody.getChild("Fault", envns12)
def get_fault(envns):
soapenv = replyroot and replyroot.getChild("Envelope", envns)
soapbody = soapenv and soapenv.getChild("Body", envns)
return soapbody and soapbody.getChild("Fault", envns)

fault = get_fault(suds.bindings.binding.envns) or get_fault(suds.bindings.binding.envns12)
return fault is not None and UmxBasic().process(fault)

def __headers(self):
Expand Down

0 comments on commit ddf097c

Please sign in to comment.