MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / ContentAppender

Class ContentAppender

suds/mx/appender.py:53–102  ·  view source on GitHub ↗

Appender used to add content to marshalled objects. @ivar default: The default appender. @type default: L{Appender} @ivar appenders: A I{table} of appenders mapped by class. @type appenders: I{table}

Source from the content-addressed store, hash-verified

51
52
53class ContentAppender:
54 """
55 Appender used to add content to marshalled objects.
56 @ivar default: The default appender.
57 @type default: L{Appender}
58 @ivar appenders: A I{table} of appenders mapped by class.
59 @type appenders: I{table}
60 """
61
62 def __init__(self, marshaller):
63 """
64 @param marshaller: A marshaller.
65 @type marshaller: L{suds.mx.core.Core}
66 """
67 self.default = PrimativeAppender(marshaller)
68 self.appenders = (
69 (Matcher(None),
70 NoneAppender(marshaller)),
71 (Matcher(null),
72 NoneAppender(marshaller)),
73 (Matcher(Property),
74 PropertyAppender(marshaller)),
75 (Matcher(Object),
76 ObjectAppender(marshaller)),
77 (Matcher(Element),
78 ElementAppender(marshaller)),
79 (Matcher(Text),
80 TextAppender(marshaller)),
81 (Matcher(list),
82 ListAppender(marshaller)),
83 (Matcher(tuple),
84 ListAppender(marshaller)),
85 (Matcher(dict),
86 DictAppender(marshaller)),
87 )
88
89 def append(self, parent, content):
90 """
91 Select an appender and append the content to parent.
92 @param parent: A parent node.
93 @type parent: L{Element}
94 @param content: The content to append.
95 @type content: L{Content}
96 """
97 appender = self.default
98 for a in self.appenders:
99 if a[0] == content.value:
100 appender = a[1]
101 break
102 appender.append(parent, content)
103
104
105class Appender:

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected