Commit 1a9d7416 by Frederik Kriewitz Committed by Tomas Hlavacek

Fix render() encoding

Fixes exceptions like this:
ERROR in CGI: Traceback (most recent call last):
  File "/var/www/html/ulg.py", line 785, in <module>
    handler.index(**params)
  File "/var/www/html/ulg.py", line 722, in index
    print self.renderULGIndex()
UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in
position 6254: ordinal not in range(128)

Signed-off-by: Tomas Hlavacek <tmshlvck@gmail.com>
parent fa12f979
......@@ -546,7 +546,7 @@ class ULGCgi:
default_commandid=commandid,
default_sessionid=sessionid,
getFormURL=self.decorator_helper.getRuncommandURL
).render('html', doctype='html')
).render('html', doctype='html', encoding='utf-8')
def renderULGAction(self,routerid=0,commandid=0,sessionid=None,**moreparams):
......@@ -638,7 +638,7 @@ class ULGCgi:
getFormURL=self.decorator_helper.getRuncommandURL,
resrange=str(session.getRange()),
resrangeb=getRangeStepURLs(session,self.decorator_helper),
).render('html', doctype='html')
).render('html', doctype='html', encoding='utf-8')
def renderULGError(self,sessionid=None,**params):
template = self.loader.load(defaults.index_template_file)
......@@ -658,7 +658,7 @@ class ULGCgi:
result=Markup(result_text) if(result_text) else None,
refresh=0,
getFormURL=self.decorator_helper.getRuncommandURL
).render('html', doctype='html')
).render('html', doctype='html', encoding='utf-8')
def renderULGDebug(self,**params):
template = self.loader.load(defaults.index_template_file)
......@@ -677,7 +677,7 @@ class ULGCgi:
result=Markup(result_text) if(result_text) else None,
refresh=0,
getFormURL=self.decorator_helper.getRuncommandURL()
).render('html', doctype='html')
).render('html', doctype='html', encoding='utf-8')
def getULGSpecialContent(self,sessionid,**params):
......@@ -711,7 +711,7 @@ class ULGCgi:
return template.generate(result=Markup(res),
url=url,
url_caption=urlc,
).render('html', doctype='html')
).render('html', doctype='html', encoding='utf-8')
def index(self, **params):
......
......@@ -138,7 +138,7 @@ class TableDecorator(object):
table_headline=Markup(self.table_headline) if self.table_headline else '',
before=Markup(self.before) if self.before else '',
after=Markup(self.after) if self.after else '',
).render('html')
).render('html', encoding='utf-8')
class TextParameter(object):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment