diff genshi/builder.py @ 379:d8c5045b547a

The builder API now accepts streams as children of elements and fragments.
author cmlenz
date Thu, 23 Nov 2006 17:48:17 +0000
parents 8e75b83d3e71
children 32b283e1d310 0742f421caba
line wrap: on
line diff
--- a/genshi/builder.py
+++ b/genshi/builder.py
@@ -46,7 +46,7 @@
 
     def append(self, node):
         """Append an element or string as child node."""
-        if isinstance(node, (Element, basestring, int, float, long)):
+        if isinstance(node, (Stream, Element, basestring, int, float, long)):
             # For objects of a known/primitive type, we avoid the check for
             # whether it is iterable for better performance
             self.children.append(node)
@@ -63,6 +63,9 @@
             if isinstance(child, Fragment):
                 for event in child._generate():
                     yield event
+            elif isinstance(child, Stream):
+                for event in child:
+                    yield event
             else:
                 if not isinstance(child, basestring):
                     child = unicode(child)
Copyright (C) 2012-2017 Edgewall Software