base: Set response charset
WebOb has started raising an exception when writing a Unicode string to `Response` objects if no charset is set.master
parent
9023294c60
commit
810f7d07b8
|
@ -30,10 +30,12 @@ class VariedResponse(milla.Response):
|
|||
context = {}
|
||||
if template is None or self.request.want == 'json':
|
||||
self.content_type = str('application/json')
|
||||
self.charset = 'utf-8'
|
||||
json.dump(context, self.body_file)
|
||||
else:
|
||||
if self.request.want == 'xhtml':
|
||||
self.content_type = str('application/xhtml+xml')
|
||||
self.charset = 'utf-8'
|
||||
self.render(template, context)
|
||||
|
||||
def render(self, template, context=None):
|
||||
|
|
Loading…
Reference in New Issue