def handler(request): r = HTTPResponse('application/json; charset=UTF-8', 'UTF-8') r.write_bytes(b) r.status_code = status_code return r
def json_response(self, obj): r = HTTPResponse('application/json; charset=UTF-8', 'UTF-8') r.write_bytes(ujson.dumps(obj)) return r
def status_response(self): assert not self.errors response = HTTPResponse('application/json; charset=UTF-8', 'UTF-8') response.write_bytes('{"status":"OK"}') return response