changeset 66:048d2f8de762

Tree - Make Node writable
author Bastian Blank <bblank@thinkmo.de>
date Sun, 30 May 2010 17:28:19 +0200
parents d3fcc3556413
children 47b1c1aa1a2b
files emeraldtree/tree.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/emeraldtree/tree.py	Sun May 30 16:55:41 2010 +0200
+++ b/emeraldtree/tree.py	Sun May 30 17:28:19 2010 +0200
@@ -77,6 +77,17 @@
     Node class.
     """
 
+    def write(self, write, encoding=None, namespaces={}, method=None):
+        if not method or method == "xml":
+            Writer = XMLWriter
+        elif method == "html":
+            Writer = HTMLWriter
+        else:
+            Writer = TextWriter
+
+        Writer(encoding, namespaces).write(write, self)
+
+
 ##
 # Element class.  This class defines the Element interface, and
 # provides a reference implementation of this interface.
@@ -370,16 +381,6 @@
             elif isinstance(e, basestring):
                 yield e
 
-    def write(self, write, encoding=None, namespaces={}, method=None):
-        if not method or method == "xml":
-            Writer = XMLWriter
-        elif method == "html":
-            Writer = HTMLWriter
-        else:
-            Writer = TextWriter
-
-        Writer(encoding, namespaces).write(write, self)
-
 
 ##
 # Subelement factory.  This function creates an element instance, and