summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-07-31 11:57:49 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-07-31 11:57:49 +0000
commitad6ac403ada75067c3858d19f16be97ef971c84d (patch)
treea52928fbc7aa7b5491960e919588d521c72cec15 /src/lib
parent9ece3b2b488409b3993892650047d4bb85c505e6 (diff)
downloadbcfg2-ad6ac403ada75067c3858d19f16be97ef971c84d.tar.gz
bcfg2-ad6ac403ada75067c3858d19f16be97ef971c84d.tar.bz2
bcfg2-ad6ac403ada75067c3858d19f16be97ef971c84d.zip
Unicode patch from Stousignant
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4843 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Server/Plugins/TGenshi.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/Server/Plugins/TGenshi.py b/src/lib/Server/Plugins/TGenshi.py
index 16470a231..8331d9735 100644
--- a/src/lib/Server/Plugins/TGenshi.py
+++ b/src/lib/Server/Plugins/TGenshi.py
@@ -39,7 +39,8 @@ class TemplateFile:
return
try:
loader = TemplateLoader()
- self.template = loader.load(self.name, cls=self.template_cls)
+ self.template = loader.load(self.name, cls=self.template_cls,
+ encoding=self.encoding)
except TemplateError, terror:
logger.error('Genshi template error: %s' % terror)
except genshi.input.ParseError, perror:
@@ -57,14 +58,16 @@ class TemplateFile:
if type(textdata) == unicode:
entry.text = textdata
else:
- logger.debug("Override encoding of template to %s" % self.encoding)
+ if self.encoding != 'ascii':
+ logger.debug("Override encoding of %s TGenshi template to %s" % (self.name, self.encoding))
entry.text = unicode(textdata, self.encoding)
else:
xmldata = stream.render('xml')
if type(xmldata) == unicode:
entry.text = xmldata
else:
- logger.debug("Override encoding of template to %s" % self.encoding)
+ if self.encoding != 'ascii':
+ logger.debug("Override encoding of %s TGenshi template to %s" % (self.name, self.encoding))
entry.text = unicode(xmldata, self.encoding)
except TemplateError, terror:
logger.error('Genshi template error: %s' % terror)