Skip to content

Commit

Permalink
Let Tornado handle JSON conversion
Browse files Browse the repository at this point in the history
If a dictionary is passed to the write function, then Tornado will
handle the conversion to JSON and the correct content-type will
also be set.
  • Loading branch information
openfirmware committed Sep 4, 2015
1 parent 3bd7028 commit 23cd601
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/service/frontend.py
Expand Up @@ -42,9 +42,9 @@ def args(self, default=None):
def checkParameter(self, reqargs, args):
return len(set(reqargs) - set(args.keys())) == 0

def _return(self, d, code=200):
def _return(self, data, code=200):
self.set_status(code)
return self.write(json.dumps(d))
return self.write(data)


class LoginHandler(BaseRequestHandler):
Expand Down

0 comments on commit 23cd601

Please sign in to comment.