def hello(): if checkAcceptIsJson(request) and checkContentIsJson(request): setResponseContentTypeJson(response) hello = HelloWorld.fromJson(parseRequestToJson(request)) return parseObjectToJson(hello) else: return abort(404)
def parseModelToJson(model): dict = model_to_dict(model) removeIdProperty(dict) return parseObjectToJson(dict)
def gettime(): if checkAcceptIsJson(request): setResponseContentTypeJson(response) return parseObjectToJson(TimeObject(time())) else: return abort(404)
def error404(error): if checkAcceptIsJson(request): return parseObjectToJson(Error())
def getmath(): if checkAcceptIsJson(request) and checkContentIsJson(request): setResponseContentTypeJson(response) return parseObjectToJson(MathOperation.fromJson(parseRequestToJson(request))) else: return abort(404)