commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8105 - trunk/gnue-common/src/definitions


From: johannes
Subject: [gnue] r8105 - trunk/gnue-common/src/definitions
Date: Thu, 24 Nov 2005 07:23:47 -0600 (CST)

Author: johannes
Date: 2005-11-24 07:23:47 -0600 (Thu, 24 Nov 2005)
New Revision: 8105

Modified:
   trunk/gnue-common/src/definitions/GBinary.py
   trunk/gnue-common/src/definitions/GParserHelpers.py
Log:
Avoid a circular import chain wrt. getChildrenAsContents ()


Modified: trunk/gnue-common/src/definitions/GBinary.py
===================================================================
--- trunk/gnue-common/src/definitions/GBinary.py        2005-11-24 08:54:44 UTC 
(rev 8104)
+++ trunk/gnue-common/src/definitions/GBinary.py        2005-11-24 13:23:47 UTC 
(rev 8105)
@@ -181,19 +181,17 @@
 
 
   # ---------------------------------------------------------------------------
-  # Return the children's content
+  # Virtual methods
   # ---------------------------------------------------------------------------
 
-  def getChildrenAsContent (self):
+  def _getAsContents_ (self):
     """
-    A L{GBinary} instance cannot have children, so the result of this function
-    is just the same as the method L{get}.
-
     @returns: the data of the object
     """
 
     return self.__data__
 
+
 # =============================================================================
 # Return any XML elements associated with GBinary
 # =============================================================================

Modified: trunk/gnue-common/src/definitions/GParserHelpers.py
===================================================================
--- trunk/gnue-common/src/definitions/GParserHelpers.py 2005-11-24 08:54:44 UTC 
(rev 8104)
+++ trunk/gnue-common/src/definitions/GParserHelpers.py 2005-11-24 13:23:47 UTC 
(rev 8105)
@@ -459,12 +459,8 @@
     result = ""
 
     for child in self._children:
-      if isinstance (child, GContent):
-        result += child._content
+      result += child._getAsContent_ ()
 
-      elif isinstance (child, GBinary):
-        result += child.__data__
-
     return result
 
 
@@ -533,6 +529,19 @@
     raise NotImplementedError
 
 
+  # ---------------------------------------------------------------------------
+
+  def _getAsContents_ (self):
+    """
+    Get the contents of this object. Usually this will be used by
+    getChildrenAsContents ().
+
+    @returns: the contents of the object.
+    """
+
+    return ""
+
+
 # =============================================================================
 # Mixin-class for leaf node objects
 # =============================================================================
@@ -647,6 +656,16 @@
     return escape and saxutils.escape (xmlString) or xmlString
 
 
+  # ---------------------------------------------------------------------------
+
+  def _getAsContent_ (self):
+    """
+    @returns: the object's contents
+    """
+
+    return self._content
+
+
 # =============================================================================
 # Base class for xml comment
 # =============================================================================





reply via email to

[Prev in Thread] Current Thread [Next in Thread]