Construct a I{composite} reply. This method is called when it has been detected that the reply has multiple root nodes. @param rtypes: A list of known return I{types}. @type rtypes: [L{suds.xsd.sxbase.SchemaObject},...] @param nodes: A collection of XML node
(self, rtypes, nodes)
| 204 | return result |
| 205 | |
| 206 | def replycomposite(self, rtypes, nodes): |
| 207 | """ |
| 208 | Construct a I{composite} reply. This method is called when it has been |
| 209 | detected that the reply has multiple root nodes. |
| 210 | @param rtypes: A list of known return I{types}. |
| 211 | @type rtypes: [L{suds.xsd.sxbase.SchemaObject},...] |
| 212 | @param nodes: A collection of XML nodes. |
| 213 | @type nodes: [L{Element},...] |
| 214 | @return: The I{unmarshalled} composite object. |
| 215 | @rtype: L{Object},... |
| 216 | """ |
| 217 | dictionary = {} |
| 218 | for rt in rtypes: |
| 219 | dictionary[rt.name] = rt |
| 220 | unmarshaller = self.unmarshaller() |
| 221 | composite = Factory.object('reply') |
| 222 | for node in nodes: |
| 223 | tag = node.name |
| 224 | rt = dictionary.get(tag, None) |
| 225 | if rt is None: |
| 226 | if node.get('id') is None: |
| 227 | raise Exception('<%s/> not mapped to message part' % tag) |
| 228 | else: |
| 229 | continue |
| 230 | resolved = rt.resolve(nobuiltin=True) |
| 231 | sobject = unmarshaller.process(node, resolved) |
| 232 | value = getattr(composite, tag, None) |
| 233 | if value is None: |
| 234 | if rt.unbounded(): |
| 235 | value = [] |
| 236 | setattr(composite, tag, value) |
| 237 | value.append(sobject) |
| 238 | else: |
| 239 | setattr(composite, tag, sobject) |
| 240 | else: |
| 241 | if not isinstance(value, list): |
| 242 | value = [value, ] |
| 243 | setattr(composite, tag, value) |
| 244 | value.append(sobject) |
| 245 | return composite |
| 246 | |
| 247 | def get_fault(self, reply): |
| 248 | """ |