Skip to content

Commit

Permalink
fix unicode decode error
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Dec 22, 2011
1 parent 64bb580 commit 11c7f0c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api.py
Expand Up @@ -40,8 +40,12 @@

class ApiHandler(webapp.RequestHandler):
def write(self, output):
if output is None:
output = ''
callback = self.request.get('callback', None)
if callback:
if not isinstance(output, unicode):
output = output.decode('utf-8')
self.response.headers['Content-type'] = 'application/javascript'
output = '%s(%s)' % (callback, output)
else:
Expand Down

0 comments on commit 11c7f0c

Please sign in to comment.