George Sakkis committed 6b9a5af

Allow attributes to be set on method Element.

Based on the latest patch from

Comments (0)

Files changed (1)


 from logging import getLogger
 from suds import *
 from suds.bindings.binding import Binding
-from suds.sax.element import Element
+from suds.sax.element import Element, Attribute
 log = getLogger(__name__)
         for pd in self.param_defs(method):
             if n < len(args):
                 value = args[n]
+            elif pd[1].isattr():
+                value = kwargs.get('_' + pd[0])
                 value = kwargs.get(pd[0])
             n += 1
+            if pd[1].isattr() and value is not None:
+                root.attributes.append(Attribute(pd[0], value))
+                continue
             # Skip non-existing by-choice arguments.
             # Implementation notes:
             #   * This functionality might be better placed inside the mkparam()
         for p in pts:
             resolved = p[1].resolve()
             for child, ancestry in resolved:
-                if child.isattr():
-                    continue
                 result.append((, child, self.bychoice(ancestry)))
         return result