def make_response(self, rv): if isinstance(rv, dict): if 'r' not in rv: rv['r'] = 0 rv = ApiResult(rv) if isinstance(rv, ApiResult): return rv.to_response() return Flask.make_response(self, rv)
def error_handler(error): if hasattr(error, 'name'): msg = error.name code = error.code else: msg = error.message code = 500 return ApiResult({'message': msg}, status=code)
def to_result(self): return ApiResult({'msg': self.message, 'r': self.code}, status=self.status)
def to_result(self): return ApiResult({'message': self.message, 'r': 1}, status=self.status)