Esempio n. 1
0
def get(request):
    """Retrieves."""
    key = request.matchdict['key']

    if key not in todos.keys():
        raise NotFound("Unknown key '%s'." % (key))

    return {key: todos[key]}
Esempio n. 2
0
def delete(request):
    """Delete all items.

    The object reference cannot change.
    
    """
    for key in todos.keys():
        del todos[key]
Esempio n. 3
0
def delete(request):
    """Delete the data item.

    Checks that the data is a valid data item.

    """
    key = request.matchdict['key']
    if not request.GET.get('access_token'):
        return Response(status=400, body=json.dumps({"error": 'access_token not found'}),
                        headers=HEADERS)

    if key not in todos.keys():
        raise NotFound("Unknown key '%s'." % (key))

    del todos[key]