From ad6ac403ada75067c3858d19f16be97ef971c84d Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Thu, 31 Jul 2008 11:57:49 +0000 Subject: Unicode patch from Stousignant git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4843 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Server/Plugins/TGenshi.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/lib/Server/Plugins') 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) -- cgit v1.2.3-1-g7c22