summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Plugins/TCheetah.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Server/Plugins/TCheetah.py')
-rw-r--r--src/lib/Server/Plugins/TCheetah.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/Server/Plugins/TCheetah.py b/src/lib/Server/Plugins/TCheetah.py
index d40f4baf3..151cc6543 100644
--- a/src/lib/Server/Plugins/TCheetah.py
+++ b/src/lib/Server/Plugins/TCheetah.py
@@ -36,7 +36,8 @@ class TemplateFile:
self.template = Cheetah.Template.Template(open(self.name).read(),
compilerSettings=s,
searchList=self.searchlist)
- except Cheetah.Parser.ParseError, perror:
+ except Cheetah.Parser.ParseError:
+ perror = sys.exc_info()[1]
logger.error("Cheetah parse error for file %s" % (self.name))
logger.error(perror.report())
@@ -52,11 +53,14 @@ class TemplateFile:
if entry.tag == 'Path':
entry.set('type', 'file')
try:
+ # py3k compatibility
+ if sys.hexversion >= 0x03000000:
+ unicode = str
if type(self.template) == unicode:
entry.text = self.template
else:
if entry.get('encoding') == 'base64':
- # take care of case where file needs base64 encoding
+ # take care of case where file needs base64 encoding
entry.text = binascii.b2a_base64(self.template)
else:
entry.text = unicode(str(self.template), self.encoding)