diff options
author | jortel <devnull@localhost> | 2010-01-05 19:54:35 +0000 |
---|---|---|
committer | jortel <devnull@localhost> | 2010-01-05 19:54:35 +0000 |
commit | a3f6cc56dc582f5f3f5c46b72a44a38597c1ff2f (patch) | |
tree | dcf289af9b514dbdb6c5e0b80992eb0b94e6631b | |
parent | 0e6e5f2f592abe06c66b392b7ea0040fcd82f513 (diff) | |
download | suds-a3f6cc56dc582f5f3f5c46b72a44a38597c1ff2f.tar.gz |
Add Ticket 291 optimization; replace string concatenation with using a character buffer (list) which is joined at the end.
-rw-r--r-- | suds/__init__.py | 2 | ||||
-rw-r--r-- | suds/sax/parser.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/suds/__init__.py b/suds/__init__.py index ce6d5de..ec16846 100644 --- a/suds/__init__.py +++ b/suds/__init__.py @@ -29,7 +29,7 @@ import sys # __version__ = '0.3.9' -__build__="(beta) R633-20091223" +__build__="(beta) R634-20100105" # # Exceptions diff --git a/suds/sax/parser.py b/suds/sax/parser.py index c130c83..447d174 100644 --- a/suds/sax/parser.py +++ b/suds/sax/parser.py @@ -59,6 +59,7 @@ class Handler(ContentHandler): if self.mapPrefix(node, attribute): continue node.append(attribute) + node.charbuffer = [] top.append(node) self.push(node) @@ -77,6 +78,9 @@ class Handler(ContentHandler): def endElement(self, name): name = unicode(name) current = self.top() + if len(current.charbuffer): + current.text = Text(u''.join(current.charbuffer)) + del current.charbuffer if len(current): current.trim() currentqname = current.qname() @@ -88,10 +92,7 @@ class Handler(ContentHandler): def characters(self, content): text = unicode(content) node = self.top() - if node.text is None: - node.text = Text(text) - else: - node.text += text + node.charbuffer.append(text) def push(self, node): self.nodes.append(node) |