Пример #1
0
def hello():
    if checkAcceptIsJson(request) and checkContentIsJson(request):
        setResponseContentTypeJson(response)
        hello = HelloWorld.fromJson(parseRequestToJson(request))
        return parseObjectToJson(hello)
    else:
        return abort(404)
Пример #2
0
def parseModelToJson(model):
    dict = model_to_dict(model)
    removeIdProperty(dict)
    return parseObjectToJson(dict)
Пример #3
0
def gettime():
    if checkAcceptIsJson(request):
        setResponseContentTypeJson(response)
        return parseObjectToJson(TimeObject(time()))
    else:
        return abort(404)
Пример #4
0
def error404(error):
    if checkAcceptIsJson(request):
        return parseObjectToJson(Error())
Пример #5
0
def getmath():
    if checkAcceptIsJson(request) and checkContentIsJson(request):
        setResponseContentTypeJson(response)
        return parseObjectToJson(MathOperation.fromJson(parseRequestToJson(request)))
    else:
        return abort(404)