Exemplo n.º 1
0
 def p_pop(self):
     self.response.headers["Content-Type"] = "application/json"
     if users.is_current_user_admin():
         storage.delete(self.request.get('key'))
         self.response.out.write(json.dumps({'status':'done'}))
     else:
         self.response.out.write(json.dumps({'status':'forbidden'}))
Exemplo n.º 2
0
    def test_delete(self):
        storage.insert(Age("mouse", 20))
        storage.delete(Age)

        saved_objects = storage.find(Age)
        self.assertEqual(len(saved_objects), 0)

        model = storage.put(Person(name="alabama"))
        storage.put(Person(name="orm"))
        storage.delete(Person, uuid=model.uuid)

        saved_objects = storage.find(Person)
        self.assertEqual(len(saved_objects), 1)
Exemplo n.º 3
0
def delete():
    ''' Deletes the posted data by looking up the posted timestamp '''
    jsonAsDict = getDictFromPost(request)
    listName = jsonAsDict.get('listName')
    postId = jsonAsDict.get('id')
    if listName != None and listName != '' and listName != 'undefined' and postId != None and postId != '' and postId != 'undefined':
        if storage.delete(listName, current_identity, postId):
            return Response('OK', 200)
        return Response('List is locked, cannot delete', 409)
    return Response('Not found', 404)
Exemplo n.º 4
0
def command_delete(id_=None):
    storage.delete('commands', int(id_))
    return "ok"
Exemplo n.º 5
0
def alarm_delete(id_):
    storage.delete('alarms', int(id_))
    alarms.set_alarms(storage.read('alarms'))
    return "ok"