Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion spyne/model/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def set_method_config_do(self, what):

class ModelBaseMeta(type(object)):
def __getitem__(self, item):
return self.customize(**item)
if isinstance(item, dict):
return self.customize(**item)

def customize(self, **kwargs):
"""Duplicates cls and overwrites the values in ``cls.Attributes`` with
Expand Down
15 changes: 11 additions & 4 deletions spyne/protocol/soap/mime.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def _join_attachment(ns_soap_env, href_id, envelope, payload, prefix=True):
"""

# grab the XML element of the message in the SOAP body
soaptree = etree.fromstring(envelope)
xml_str_without_declaration = "\n".join(envelope.split("\n")[1:])
soaptree = etree.fromstring(xml_str_without_declaration)
soapbody = soaptree.find("{%s}Body" % ns_soap_env)

if soapbody is None:
Expand Down Expand Up @@ -215,9 +216,15 @@ def apply_mtom(headers, envelope, params, paramvals):
"""

# grab the XML element of the message in the SOAP body
envelope = ''.join(envelope)
envelope = ''.join([b.decode("utf-8") for b in envelope])
xml_str_without_declaration = "\n".join(envelope.split("\n")[1:])

soaptree = etree.fromstring(xml_str_without_declaration)
for ns in soaptree.nsmap.items():
if 'soap' in ns[1]:
_ns_soap_env = ns[1]
break

soaptree = etree.fromstring(envelope)
soapbody = soaptree.find("{%s}Body" % _ns_soap_env)

message = None
Expand Down Expand Up @@ -266,7 +273,7 @@ def apply_mtom(headers, envelope, params, paramvals):

# Extract attachments from SOAP envelope.
for i in range(len(params)):
name, typ = params[i]
typ = params[i]

if issubclass(typ, (ByteArray, File)):
id = "SpyneAttachment_%s" % (len(mtompkg.get_payload()), )
Expand Down