Commits

George Sakkis committed 6b9a5af

Allow attributes to be set on method Element.

Based on the latest patch from https://fedorahosted.org/suds/ticket/21.

Comments (0)

Files changed (1)

suds/bindings/document.py

 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])
             else:
                 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.name, child, self.bychoice(ancestry)))
         return result