summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjortel <devnull@localhost>2010-02-09 16:31:27 +0000
committerjortel <devnull@localhost>2010-02-09 16:31:27 +0000
commit9a7461ad8920b2d342d3b9a4931f33776450eb4c (patch)
tree39657bb2adb9c78faf4de73e4cc230ec57836eed
parentf863d39816784bb25aca559c98a113bf57d78553 (diff)
downloadsuds-9a7461ad8920b2d342d3b9a4931f33776450eb4c.tar.gz
Fix ticket #296. unmarshalling soap encoded arrays when array element has attributes.
-rw-r--r--suds/__init__.py2
-rw-r--r--suds/umx/encoded.py23
2 files changed, 18 insertions, 7 deletions
diff --git a/suds/__init__.py b/suds/__init__.py
index 2b2e1d2..da7a469 100644
--- a/suds/__init__.py
+++ b/suds/__init__.py
@@ -27,7 +27,7 @@ import sys
#
__version__ = '0.3.9'
-__build__="(beta) R656-20100202"
+__build__="(beta) R657-20100209"
#
# Exceptions
diff --git a/suds/umx/encoded.py b/suds/umx/encoded.py
index f613a5c..afe7374 100644
--- a/suds/umx/encoded.py
+++ b/suds/umx/encoded.py
@@ -54,10 +54,7 @@ class Encoded(Typed):
#
aty = content.aty
if aty is not None:
- if len(content.data):
- content.data = content.data[0]
- else:
- content.data = []
+ self.promote(content)
return Typed.end(self, content)
def postprocess(self, content):
@@ -97,7 +94,7 @@ class Encoded(Typed):
(child nodes) of the array. Each element (node) in the array
that does not have an explicit xsi:type attribute is given one
based on the I{arrayType}.
- @param content: A array content.
+ @param content: An array content.
@type content: L{Content}
@param xty: The XSI type reference.
@type xty: str
@@ -114,4 +111,18 @@ class Encoded(Typed):
attr = ':'.join((ns[0], name))
child.set(attr, xty)
return self
- \ No newline at end of file
+
+ def promote(self, content):
+ """
+ Promote (replace) the content.data with the first attribute
+ of the current content.data that is a I{list}. Note: the
+ content.data may be empty or contain only _x attributes.
+ In either case, the content.data is assigned an empty list.
+ @param content: An array content.
+ @type content: L{Content}
+ """
+ for n,v in content.data:
+ if isinstance(v, list):
+ content.data = v
+ return
+ content.data = [] \ No newline at end of file