[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5612 - trunk/gnue-common/src/definitions
From: |
btami |
Subject: |
r5612 - trunk/gnue-common/src/definitions |
Date: |
Fri, 2 Apr 2004 03:34:00 -0600 (CST) |
Author: btami
Date: 2004-04-02 03:33:59 -0600 (Fri, 02 Apr 2004)
New Revision: 5612
Modified:
trunk/gnue-common/src/definitions/GObjects.py
trunk/gnue-common/src/definitions/GParserHelpers.py
Log:
unicode fix in GContent (by kilo)
Modified: trunk/gnue-common/src/definitions/GObjects.py
===================================================================
--- trunk/gnue-common/src/definitions/GObjects.py 2004-04-02 04:14:56 UTC
(rev 5611)
+++ trunk/gnue-common/src/definitions/GObjects.py 2004-04-02 09:33:59 UTC
(rev 5612)
@@ -92,7 +92,7 @@
thru the GObj tree as many times as necessary to fully initialize the
tree. It determines the number of interations to perform during it's
first pass down the tree.
-
+
phaseInit looks for a private list variable called _inits that
contains a list of functions to execute. Here is an example from
gnue-forms GFForm object.
@@ -109,7 +109,7 @@
object may need specific infomation from some of its children to properly
initialize itself. This type of logic cannot be places into an __init__
as the children may not be loaded yet or may not yet have the needed
- information.
+ information.
"""
if iterations == 0:
iterations = self.maxInits()
@@ -186,15 +186,15 @@
"""
A recusive function to print an indented text representation of
the GObj tree from this object down.
-
+
This is usefull for debugging purposes.
-
+
@param indent: Sets the level of indention. Used during recursion
to properly indent the tree.
@type indent: int
"""
print ' ' * indent + `self._type`,self
-
+
for child in self._children:
child.showTree(indent + 2)
@@ -337,7 +337,7 @@
if treeDump:
for child in self._children:
xmlString += child.dumpXML(lookupDict, 1,gap+" ",
- xmlnamespaces=xmlnamespaces)
+ textEncoding=textEncoding, xmlnamespaces=xmlnamespaces)
if hasContent:
xmlString += "</%s%s>\n" % (xmlns, xmlEntity)
Modified: trunk/gnue-common/src/definitions/GParserHelpers.py
===================================================================
--- trunk/gnue-common/src/definitions/GParserHelpers.py 2004-04-02 04:14:56 UTC
(rev 5611)
+++ trunk/gnue-common/src/definitions/GParserHelpers.py 2004-04-02 09:33:59 UTC
(rev 5612)
@@ -1,18 +1,18 @@
#
# This file is part of GNU Enterprise.
#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
# version 2, or (at your option) any later version.
#
-# GNU Enterprise is distributed in the hope that it will be
+# GNU Enterprise is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
@@ -30,6 +30,7 @@
#
from xml.sax import saxutils
+from types import StringType
#
# Class ParserObj
@@ -67,12 +68,21 @@
return self._content
def dumpXML(self, lookupDict, treeDump=None, gap=None,
- escape=1, xmlnamespaces={}):
+ escape=1, textEncoding='<locale>', xmlnamespaces={}):
+ if textEncoding=='<locale>':
+ textEncoding=gConfig('textEncoding')
+
+ if type(self._content) == StringType:
+ xmlString = '%s' % unicode(self._content, textEncoding)
+ else:
+ xmlString = self._content
+
if escape:
- return saxutils.escape(self._content)
+ return saxutils.escape(xmlString)
else:
- return self._content
+ return xmlString
+
def showTree(self, indent=0):
print ' '*indent + 'GContent ' + `self._content`
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5612 - trunk/gnue-common/src/definitions,
btami <=