1. Bernhard Leiner
  2. suds python 3 patches

Source

suds python 3 patches / reply-and-reponse-as-strings

# HG changeset patch
# Parent e67d9afcfe1db46224a36e5425db660402d0dde1
Fix converting binary SOAP Request & Reply data to strings.

Request & Reply 'message' member contains binary & not unicode-string data. When
a string is needed (e.g. when logging SOAP request or reply content) we now use
Python's internal and non-ambiguous representation for this data.

Optionally, we could 'assume the data is actually an utf-8 encoded unicode
string', decode it and get a bit nicer string output, i.e. without the "b''"
wrapper and without having non-ASCII characters displayed as escaped hexadecimal
character codes, but that would require much more detailed usage research to
make sure our assumption holds.

diff --git a/suds/transport/__init__.py b/suds/transport/__init__.py
--- a/suds/transport/__init__.py
+++ b/suds/transport/__init__.py
@@ -52,7 +52,7 @@
         s.append('URL:%s' % self.url)
         s.append('HEADERS: %s' % self.headers)
         s.append('MESSAGE:')
-        s.append(self.message)
+        s.append(str(self.message))
         return '\n'.join(s)
 
 
@@ -85,7 +85,7 @@
         s.append('CODE: %s' % self.code)
         s.append('HEADERS: %s' % self.headers)
         s.append('MESSAGE:')
-        s.append(self.message)
+        s.append(str(self.message))
         return '\n'.join(s)