From 719a6c9b335d793708efa6dd76de2de935b5d4fe Mon Sep 17 00:00:00 2001 From: Davorin Kunstelj Date: Fri, 16 May 2014 14:11:42 +0200 Subject: [PATCH] Dispatching custom objects, slots supported. --- src/SOAPpy/SOAPBuilder.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SOAPpy/SOAPBuilder.py b/src/SOAPpy/SOAPBuilder.py index 2f8f392..f4f43fd 100644 --- a/src/SOAPpy/SOAPBuilder.py +++ b/src/SOAPpy/SOAPBuilder.py @@ -679,8 +679,10 @@ class SOAPBuilder: self.out.append('<%s%s%s>\n' % (tag, id, r)) d1 = getattr(obj, '__dict__', None) + if d1 is None and hasattr(obj, "__slots__") + d1 = dict(((k, getattr(obj, k)) for k in obj.__slots__)) if d1 is not None: - for (k, v) in d1: + for (k, v) in d1.items(): if k[0] != "_": self.dump(v, k, 1, ns_map)