Ejemplo n.º 1
0
def quoteoftheday():
    if checkAcceptIsJson(request):
        setResponseContentTypeJson(response)
        quote = QuoteOfDay.get(QuoteOfDay.id == 1)
        return parseModelToJson(quote)
    else:
        return abort(404)
Ejemplo n.º 2
0
def quoteoftheday():
    if checkAcceptIsJson(request) and checkContentIsJson(request):
        setResponseContentTypeJson(response)
        json = parseRequestToJson(request)
        updatedQuote = QuoteOfDay.update(author = json['author'], quote = json['quote'], date = date.today().isoformat()).where(QuoteOfDay.id == 1)
        updatedQuote.execute()
    else:
        return abort(404)